Skip to content

Commit 871007d

Browse files
segoonmasatake
authored andcommitted
OpenAPI: extract the names of tags
Based on #3258.
1 parent 692f5fd commit 871007d

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Units/parser-openapi.r/openapi.d/expected.tags

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ NullableFieldStringEnum input.yaml /^ NullableFieldStringEnum:$/;" d
77
CustomHeader input.yaml /^ CustomHeader:$/;" P
88
Response1 input.yaml /^ Response1:$/;" R
99
Response2 input.yaml /^ Response2:$/;" R
10+
android_handler input.yaml /^ - name: android_handler$/;" T
11+
ios_handler input.yaml /^ - name: ios_handler$/;" T

Units/parser-openapi.r/openapi.d/input.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,9 @@ components:
5353
schema:
5454
type: object
5555
properties: {}
56+
57+
tags:
58+
- name: android_handler
59+
description: Handler for Android clients
60+
- name: ios_handler
61+
description: Handler for iOS clients

parsers/openapi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ typedef enum {
3030
KIND_PARAMETER,
3131
KIND_TITLE,
3232
KIND_SERVER,
33+
KIND_TAG,
3334
} openapiKind;
3435

3536
static kindDefinition OpenAPIKinds [] = {
@@ -39,6 +40,7 @@ static kindDefinition OpenAPIKinds [] = {
3940
{ true, 'P', "parameter", "parameters" },
4041
{ true, 't', "title", "titles" },
4142
{ true, 's', "server", "servers (or hosts in swagger)" },
43+
{ true, 'T', "tag", "tags"},
4244
};
4345

4446
/* - name: "THE NAME" */
@@ -75,6 +77,8 @@ static tagYpathTable ypathTables [] = {
7577
DSTAT_LAST_VALUE, KIND_SERVER, },
7678
{ "host",
7779
DSTAT_LAST_VALUE, KIND_SERVER, },
80+
{ "tags/*/name",
81+
DSTAT_LAST_VALUE, KIND_TAG, },
7882
};
7983

8084
static void openapiPlayStateMachine (struct sOpenAPISubparser *openapi,

0 commit comments

Comments
 (0)