Skip to content

Commit

Permalink
OpenAPI: extract the names of tags
Browse files Browse the repository at this point in the history
  • Loading branch information
segoon authored and masatake committed Feb 7, 2022
1 parent 692f5fd commit 871007d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Units/parser-openapi.r/openapi.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ NullableFieldStringEnum input.yaml /^ NullableFieldStringEnum:$/;" d
CustomHeader input.yaml /^ CustomHeader:$/;" P
Response1 input.yaml /^ Response1:$/;" R
Response2 input.yaml /^ Response2:$/;" R
android_handler input.yaml /^ - name: android_handler$/;" T
ios_handler input.yaml /^ - name: ios_handler$/;" T
6 changes: 6 additions & 0 deletions Units/parser-openapi.r/openapi.d/input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,9 @@ components:
schema:
type: object
properties: {}

tags:
- name: android_handler
description: Handler for Android clients
- name: ios_handler
description: Handler for iOS clients
4 changes: 4 additions & 0 deletions parsers/openapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ typedef enum {
KIND_PARAMETER,
KIND_TITLE,
KIND_SERVER,
KIND_TAG,
} openapiKind;

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

/* - name: "THE NAME" */
Expand Down Expand Up @@ -75,6 +77,8 @@ static tagYpathTable ypathTables [] = {
DSTAT_LAST_VALUE, KIND_SERVER, },
{ "host",
DSTAT_LAST_VALUE, KIND_SERVER, },
{ "tags/*/name",
DSTAT_LAST_VALUE, KIND_TAG, },
};

static void openapiPlayStateMachine (struct sOpenAPISubparser *openapi,
Expand Down

0 comments on commit 871007d

Please sign in to comment.