autorest
autorest copied to clipboard
convert to Oai3 exception
Before filling a bug
- [ ] have you checked the faq for known issues.
- [ ] have you checked existing issues
Describe the bug when I am trying to add a lint plugin to use the 'loader-swagger' as input , but the 'convertOai2ToOai3' still get invoked and it will throw some errors, as my lint is not public now, you can use the below equivalent command to repro
> lint plugin readme.md
pipeline:
swagger-document/openapi-validator:
input: swagger-document/loader-swagger
scope: azure-validator-individual
- the original command is like
autorest --v3 --azure-validator --use=<lint-plugin-folder> https://github.com/Azure/azure-rest-api-specs/blob/a615f5cfc187b9c6fa9799a2f315addc537c0f5c/specification/notebooks/resource-manager/Microsoft.Notebooks/preview/2019-10-11-preview/readme.md --debug
- equivalent Autorest command used
autorest --v3 --output-artifact=openapi-document https://github.com/Azure/azure-rest-api-specs/blob/a615f5cfc187b9c6fa9799a2f315addc537c0f5c/specification/notebooks/resource-manager/Microsoft.Notebooks/preview/2019-10-11-preview/readme.md --debug
- Error message
Error: Operation response '/paths/~1providers~1Microsoft.Notebooks~1operations/get/responses/200' produces type couldn't be resolved. Operation is probably is missing a produces field and there isn't any global value. Please add "produces": [<contentType>]"
Expected behavior
wonder if autorest pipeline can stop after the lint plugin is ran , do not run other plugins which is useless and might bring exception for the lint.
like,
debug | [2.87 s] swagger-document/individual/transform - START inputs = 1
debug | [2.87 s] swagger-document/individual/transform - END [0 s][76 MB]
debug | [2.88 s] swagger-document/individual/schema-validator-swagger - START inputs = 1
debug | [3.51 s] swagger-document/individual/schema-validator-swagger - END [0.63 s][75 MB]
debug | [3.51 s] swagger-document/individual/full-ref-resolver - START inputs = 1
debug | [3.52 s] swagger-document/individual/full-ref-resolver - END [0 s][76 MB]
Additional context Add any other context about the problem here.
@timotheeguerin any update with this issue
Not really, now sure how we can make this without it being very hacky and being a pain to maintain in the future.
The problem here is the pipeline in autorest is built as things are defined instead of being built when a plugin is required by the next one. This means that as soon as autorest core is loaded all the plugins are loaded and inserted in the pipeline. The real solution would be to change the pipeline definition to more of a dependency model and then have something triggering a certain plugin to be loaded and all the dependencies. However I don't see how we can do this without breaking everyone.
can we have a switch for this feature, if the switch is off we can run as before