swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

Object schema property field data type validation of OpenAPIV3Parser

Open lnash94 opened this issue 4 years ago • 0 comments

Hi team I'm using OpenAPIV3Parser for getting openapi specifications. This is the way I used to parse the openAPI yaml file

String openAPIFileContent = Files.readString(openapi.yaml);        
ParseOptions parseOptions = new ParseOptions();
parseOptions.setResolve(true);
SwaggerParseResult parseResult = new OpenAPIV3Parser().readContents(openAPIFileContent, null, parseOptions);

Could you please let me know whether there is a way of getting datatype validation warnings or errors when I provide YAML with an invalid data type to the property data type? sample of code: invalid field is id with datatype int.

...
components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: int
        name:
          type: string

lnash94 avatar Jul 01 '21 06:07 lnash94