feat(sample-gen): infer implicit type and validation constraint types #7117
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
this close some dead ends of sample generation where no sample was generated.
currently with v3.30.0:
https://petstore3.swagger.io/?url=https://gist.githubusercontent.com/mathis-m/6839105763cbe96755c4b6455c69278b/raw/543198cdd6a232a4465eac19537bb2c7805b80e9/uR3BxRNUhU.txt
I think the proper solution for this would be to default type to string if not defined. This would result in a stable behavior too and we could keep the decision to generate the using first anyOf for anyOf samples. I think this is the a spec conform sample generation logic, because it is the "most simple" case for anyOf that can emerge from such a schema.
With #7117:
Originally posted by @mathis-m in swagger-api/swagger-editor#2416 (comment)
Motivation and Context
Fixes swagger-api/swagger-editor#2416
How Has This Been Tested?
Checklist
My PR contains...
src/
is unmodified: changes to documentation, CI, metadata, etc.)package.json
)My changes...
Documentation
Automated tests