From 871007dc55b1297703d4fd39d217c110dda5671f Mon Sep 17 00:00:00 2001 From: Vasily Kulikov Date: Thu, 6 Jan 2022 19:06:51 +0300 Subject: [PATCH] OpenAPI: extract the names of tags Based on #3258. --- Units/parser-openapi.r/openapi.d/expected.tags | 2 ++ Units/parser-openapi.r/openapi.d/input.yaml | 6 ++++++ parsers/openapi.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/Units/parser-openapi.r/openapi.d/expected.tags b/Units/parser-openapi.r/openapi.d/expected.tags index 050091bde5..ce4549d743 100644 --- a/Units/parser-openapi.r/openapi.d/expected.tags +++ b/Units/parser-openapi.r/openapi.d/expected.tags @@ -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 diff --git a/Units/parser-openapi.r/openapi.d/input.yaml b/Units/parser-openapi.r/openapi.d/input.yaml index 58b3624322..4411e7d057 100644 --- a/Units/parser-openapi.r/openapi.d/input.yaml +++ b/Units/parser-openapi.r/openapi.d/input.yaml @@ -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 diff --git a/parsers/openapi.c b/parsers/openapi.c index b3234da4e4..f01c8c6f49 100644 --- a/parsers/openapi.c +++ b/parsers/openapi.c @@ -30,6 +30,7 @@ typedef enum { KIND_PARAMETER, KIND_TITLE, KIND_SERVER, + KIND_TAG, } openapiKind; static kindDefinition OpenAPIKinds [] = { @@ -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" */ @@ -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,