Open arunvangapelli opened 4 years ago
The results I got for both options Option 1:
class Schema {
type: null
format: null
$ref: #/components/schemas/inline_response_200
description: null
title: null
multipleOf: null
maximum: null
exclusiveMaximum: null
minimum: null
exclusiveMinimum: null
maxLength: null
minLength: null
pattern: null
maxItems: null
minItems: null
uniqueItems: null
maxProperties: null
minProperties: null
required: null
not: null
properties: null
additionalProperties: null
nullable: null
readOnly: null
writeOnly: null
example: null
externalDocs: null
deprecated: null
discriminator: null
xml: null
}
Option 2:
class ObjectSchema {
class Schema {
type: object
format: null
$ref: null
description: null
title: null
multipleOf: null
maximum: null
exclusiveMaximum: null
minimum: null
exclusiveMinimum: null
maxLength: null
minLength: null
pattern: null
maxItems: null
minItems: null
uniqueItems: null
maxProperties: null
minProperties: null
required: [id, name]
not: null
properties: {id=class StringSchema {
class Schema {
type: string
format: null
$ref: null
description: null
title: null
multipleOf: null
maximum: null
exclusiveMaximum: null
minimum: null
exclusiveMinimum: null
maxLength: null
minLength: null
pattern: null
maxItems: null
minItems: null
uniqueItems: null
maxProperties: null
minProperties: null
required: null
not: null
properties: null
additionalProperties: null
nullable: null
readOnly: null
writeOnly: null
example: null
externalDocs: null
deprecated: null
discriminator: null
xml: null
}
}, name=class StringSchema {
class Schema {
type: string
format: null
$ref: null
description: null
title: null
multipleOf: null
maximum: null
exclusiveMaximum: null
minimum: null
exclusiveMinimum: null
maxLength: null
minLength: null
pattern: null
maxItems: null
minItems: null
uniqueItems: null
maxProperties: null
minProperties: null
required: null
not: null
properties: null
additionalProperties: null
nullable: null
readOnly: null
writeOnly: null
example: null
externalDocs: null
deprecated: null
discriminator: null
xml: null
}
}, dob=class StringSchema {
class Schema {
type: string
format: null
$ref: null
description: null
title: null
multipleOf: null
maximum: null
exclusiveMaximum: null
minimum: null
exclusiveMinimum: null
maxLength: null
minLength: null
pattern: null
maxItems: null
minItems: null
uniqueItems: null
maxProperties: null
minProperties: null
required: null
not: null
properties: null
additionalProperties: null
nullable: null
readOnly: null
writeOnly: null
example: null
externalDocs: null
deprecated: null
discriminator: null
xml: null
}
}, internalObject=class Schema {
type: null
format: null
$ref: #/components/schemas/test-model
description: null
title: null
multipleOf: null
maximum: null
exclusiveMaximum: null
minimum: null
exclusiveMinimum: null
maxLength: null
minLength: null
pattern: null
maxItems: null
minItems: null
uniqueItems: null
maxProperties: null
minProperties: null
required: null
not: null
properties: null
additionalProperties: null
nullable: null
readOnly: null
writeOnly: null
example: null
externalDocs: null
deprecated: null
discriminator: null
xml: null
}}
additionalProperties: null
nullable: null
readOnly: null
writeOnly: null
example: null
externalDocs: null
deprecated: null
discriminator: null
xml: null
}
}
Hi @arunvangapelli please try: OpenAPIParser openApiParser = new OpenAPIParser(); ParseOptions options = new ParseOptions(); options.setResolve(true); options.setResolveFully(true); SwaggerParseResult sr = openApiParser.readContents(spec, null, options);
Hi @gracekarina Sorry for late response. I tried that but I still didn't get the fully resolved schema. When trying to get the schema anything else I need to try other than what I'm doing in option 1 or 2?
Below is the spec which I'm trying to parse.
The library I'm using:
implementation 'io.swagger.parser.v3:swagger-parser:2.0.19'
I have the spec as a String. So, my code is like below:
I have tried to print the schema in couple of ways, but I didn't get the schema as I expected.
Option 1:
Option 2:
I'm trying to get schema in this format so that I can use it to validate against my API response.
Please let me know, if I need to try anything else or other parsers. Thanks.