Azure / Azure/azure-openapi-validator
Azure API Management schema validator for CI jobs
- Dominant language
- TypeScript
- Stars
- 53
- Forks
- 57
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 2
Description
Please provide a documentation on how to validate openapi and swagger documents for the Azure APIM import.
I can't find a way to get the same errors in autorest (e.g.) thrown by the azure api management import.
Also tried a lot of other validators, and all of them seem to consider some specs as valid where apim would reject with schema validation error.
## autorest
`autorest --v3 --azure-validator --input-file=openapi.json`
```
AutoRest code generation utility [cli version: 3.0.6247; node: v12.19.0, max-memory: 2048 gb]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core '/home/ema/.autorest/@autorest_core@3.0.6320/node_modules/@autorest/core/dist' (3.0.6320)
Installing AutoRest extension '@microsoft.azure/classic-openapi-validator' (~1.0.9)
Installed AutoRest extension '@microsoft.azure/classic-openapi-validator' (~1.0.9->1.0.14)
Installing AutoRest extension '@microsoft.azure/openapi-validator' (~1.0.2)
Installed AutoRest extension '@microsoft.azure/openapi-validator' (~1.0.2->1.0.4)
[21.56 s] Generation Complete
```
## azure portal import
```
Parsing error(s): The key 'KeyValuePair`2' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. [#/components]
Parsing error(s): The input OpenAPI file is not valid for the OpenAPI specification https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md (schema https://github.com/OAI/OpenAPI-Specification/blob/master/schemas/v3.0/schema.yaml).
```
This is very important for CI workflows to use the validation as PR gate before accepting merges.
Contributor guide
Assessment
This issue has not been assessed yet.