-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix parsing swagger2 by API Catalog (#2876)
* fix * fix in case an error is thrown (i.e. class is not defined) * basic test to verify the API doc service is parsing the document * extend unit test for object verification
- Loading branch information
Showing
9 changed files
with
236 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
api-catalog-services/src/test/resources/swagger/openapi3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "Sample of OpenAPI v3", | ||
"description": "For testing purposes - parse the doc file", | ||
"version": "1.0.0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "https://localhost:8081/service/api/v1", | ||
"description": "Main server" | ||
} | ||
], | ||
"tags": [ | ||
{ | ||
"name": "tagName", | ||
"description": "First tag in the list" | ||
} | ||
], | ||
"paths": { | ||
"/endpoint": { | ||
"post": { | ||
"tags": [ | ||
"Receive data" | ||
], | ||
"summary": "This endpoint returns a data", | ||
"operationId": "receive", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/Response", | ||
"exampleSetFlag": false | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"204": { | ||
"description": "Successful - data were returned" | ||
}, | ||
"400": { | ||
"description": "Invalid request" | ||
} | ||
}, | ||
"security": [ | ||
{ | ||
"basicAuth": [] | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"Response": { | ||
"title": "Response object", | ||
"type": "object", | ||
"properties": { | ||
"output": { | ||
"type": "string", | ||
"description": "data", | ||
"exampleSetFlag": false | ||
} | ||
}, | ||
"exampleSetFlag": false | ||
} | ||
}, | ||
"securitySchemes": { | ||
"basicAuth": { | ||
"type": "http", | ||
"scheme": "basic" | ||
}, | ||
"bearerAuth": { | ||
"type": "http", | ||
"scheme": "bearer" | ||
} | ||
}, | ||
"extensions": {} | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
api-catalog-services/src/test/resources/swagger/swagger2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "Example of Swagger for testing", | ||
"version": "1.0", | ||
"title": "APIML test API" | ||
}, | ||
"basePath": "/api/v1", | ||
"tags": [ | ||
{ | ||
"name": "firstTag" | ||
} | ||
], | ||
"securityDefinitions": { | ||
"BasicAuth": { | ||
"type": "basic" | ||
}, | ||
"BearerAuth": { | ||
"type": "apiKey", | ||
"in": "header", | ||
"name": "Authorization" | ||
} | ||
}, | ||
"security": [ | ||
{ | ||
"BasicAuth": [] | ||
}, | ||
{ | ||
"BearerAuth": [] | ||
} | ||
], | ||
"paths": { | ||
"/": { | ||
"get": { | ||
"tags": [ | ||
"List" | ||
], | ||
"summary": "Example of GET endpoint", | ||
"description": "Only for testing", | ||
"operationId": "getData", | ||
"produces": [ | ||
"application/json" | ||
], | ||
"parameters": [], | ||
"responses": { | ||
"200": { | ||
"description": "Successful operation", | ||
"schema": { | ||
"$ref": "#/definitions/exampleResponse200" | ||
} | ||
}, | ||
"500": { | ||
"description": "Unexpected internal error. Contact your support" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"exampleResponse200": { | ||
"type": "object", | ||
"required": [ | ||
"action" | ||
], | ||
"properties": { | ||
"output": { | ||
"type": "string", | ||
"description": "Contains the sample response test", | ||
"example": "success" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters