swagger-api / swagger-api/swagger-parser
Object schema property field data type validation of OpenAPIV3Parser
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The payload names OpenAPIV3Parser, ParseOptions, and SwaggerParseResult; start by tracing how readContents reports parse problems when ParseOptions#setResolve(true) is used. Confirm whether the invalid type: int in the User schema is surfaced as a warning or error, and make that behavior explicit in coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100