You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used following code snippet to parse the OpenAPI definition and prettyprint it to a json value. But it seems like that the license.identifier is dropped out from the resulting JSON.
Swagger parser 2.1.20
String openApiFilePath = "<Path>/Petstore-3.1.0.yaml"; // Replace this with the path to your OpenAPI 3.1 specification file
// Create a new instance of OpenAPIV3Parser
OpenAPIV3Parser openAPIParser = new OpenAPIV3Parser();
// Parse the OpenAPI specification
SwaggerParseResult parseResult = openAPIParser.readLocation(openApiFilePath, null, null);
String parser = Json.pretty(parseResult.getOpenAPI());
Sample openAPI spec
openapi: 3.1.0
info:
title: Sample API
version: 1.0.0
description: This is a sample API specification with license identifier.
license:
name: Apache 2.0
identifier: Apache-2.0
contact:
name: API Support
email: [email protected]
url: https://www.example.com/support
servers:
- url: https://api.example.com/v1
paths:
/users:
get:
summary: Retrieves a list of users
responses:
'200':
description: A list of users
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
description: The user's ID
username:
type: string
description: The user's username
The text was updated successfully, but these errors were encountered:
I used following code snippet to parse the OpenAPI definition and prettyprint it to a json value. But it seems like that the license.identifier is dropped out from the resulting JSON.
Swagger parser 2.1.20
Sample openAPI spec
The text was updated successfully, but these errors were encountered: