Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
segoon committed Jan 5, 2022
1 parent 4098994 commit 97915e7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
24 changes: 24 additions & 0 deletions Units/parser-openapi.r/openapi.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
/sample/other/path input.yaml /^ \/sample\/other\/path:$/;" p
/sample/path input.yaml /^ \/sample\/path:$/;" p
Body1 input.yaml /^ Body1:$/;" B
Body2 input.yaml /^ Body2:$/;" B
Callback1 input.yaml /^ Callback1: {}$/;" c
Callback2 input.yaml /^ Callback2: {}$/;" c
CustomHeader input.yaml /^ CustomHeader:$/;" P
Example1 input.yaml /^ Example1:$/;" e
Example2 input.yaml /^ Example2:$/;" e
Header1 input.yaml /^ Header1:$/;" h
Header2 input.yaml /^ Header2:$/;" h
Link1 input.yaml /^ Link1: {}$/;" l
Link2 input.yaml /^ Link2: {}$/;" l
NullableField input.yaml /^ NullableField:$/;" d
NullableFieldStringEnum input.yaml /^ NullableFieldStringEnum:$/;" d
PathItem1 input.yaml /^ PathItem1: {}$/;" A
PathItem2 input.yaml /^ PathItem2: {}$/;" A
Response1 input.yaml /^ Response1:$/;" R
Response2 input.yaml /^ Response2:$/;" R
SSchema1 input.yaml /^ SSchema1:$/;" C
SSchema2 input.yaml /^ SSchema2:$/;" C
android_handler input.yaml /^ - name: android_handler$/;" t
apiKey input.yaml /^ - type: apiKey$/;" s
description input.yaml /^ description: test$/;" I
http input.yaml /^ - type: http$/;" s
http://example.com input.yaml /^ url: http:\/\/example.com$/;" D
http://example.com input.yaml /^ - url: http:\/\/example.com$/;" S
http://example2.com input.yaml /^ - url: http:\/\/example2.com$/;" S
ios_handler input.yaml /^ - name: ios_handler$/;" t
title input.yaml /^ title: test$/;" I
version input.yaml /^ version: '1.0'$/;" I
3 changes: 3 additions & 0 deletions Units/parser-openapi.r/swagger.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ PolymorphicInteger input.yaml /^ PolymorphicInteger:$/;" d
PolymorphicString input.yaml /^ PolymorphicString:$/;" d
Response1 input.yaml /^ Response1:$/;" R
Response2 input.yaml /^ Response2:$/;" R
description input.yaml /^ description: test$/;" I
title input.yaml /^ title: test$/;" I
version input.yaml /^ version: '1.0'$/;" I
12 changes: 6 additions & 6 deletions parsers/openapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static kindDefinition OpenApiKinds [] = {
{ true, 'S', "server", "servers"},
{ true, 's', "security", "security"},
{ true, 't', "tag", "tags"},
{ true, 'x', "example", "examples"},
{ true, 'e', "example", "examples"},
{ true, 'D', "doc", "docs"},
{ true, 'B', "requestBody", "requestBodies"},
{ true, 'h', "header", "headers"},
Expand Down Expand Up @@ -462,7 +462,7 @@ static void handleKey(struct sOpenApiSubparser *openapi,
ts->countKeys
))
{
printf("match! i=%d, value=%s\n", i, token->data.scalar.value);
// printf("match! i=%d, value=%s\n", i, token->data.scalar.value);

tagEntryInfo tag;
initTagEntry (&tag, (char *)token->data.scalar.value, ts->kind);
Expand All @@ -489,7 +489,7 @@ static void handleValue(struct sOpenApiSubparser *openapi,
ts->countKeys
))
{
printf("match value! i=%d\n", i);
// printf("match value! i=%d\n", i);

tagEntryInfo tag;
initTagEntry (&tag, (char *)token->data.scalar.value, ts->kind);
Expand All @@ -504,7 +504,7 @@ static void handleValue(struct sOpenApiSubparser *openapi,
static void openapiPlayStateMachine (struct sOpenApiSubparser *openapi,
yaml_token_t *token)
{
printStack(openapi->type_stack);
// printStack(openapi->type_stack);

switch (token->type)
{
Expand All @@ -515,11 +515,11 @@ static void openapiPlayStateMachine (struct sOpenApiSubparser *openapi,
switch (openapi->play_detection_state) {
case DSTAT_LAST_KEY:
openapi->type_stack->key = parseKey (token);
printf (" key: %s\n", (char*)token->data.scalar.value);
// printf (" key: %s\n", (char*)token->data.scalar.value);
handleKey (openapi, token);
break;
case DSTAT_LAST_VALUE:
printf (" value: %s\n", (char*)token->data.scalar.value);
// printf (" value: %s\n", (char*)token->data.scalar.value);
handleValue (openapi, token);
break;
default:
Expand Down

0 comments on commit 97915e7

Please sign in to comment.