-
Notifications
You must be signed in to change notification settings - Fork 933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot overwrite generated schema #1528
Comments
Your question highlights the fact that for a long time I didn't really have a clue what I was doing in the codebase :) |
Something like an Having a quick look at the I can even try and have a look at it sometime and see if this would be easy to change this in a PR. |
I encountered an issue while trying to create a fix for our generated enums nelmio/NelmioApiDocBundle#2177
While doing this I noticed that the
AugmentProperties
processor makes sure to set theoneOf
property whenever aref
is set on anullable === true
schema.swagger-php/src/Processors/AugmentProperties.php
Lines 172 to 185 in a70a5dc
I wanted to overwrite this by creating a new processor which would revert this ONLY for schemas based on enums. See implementation:
I assumed this to work because I though that processors were 'absolute', this seems to not be the case because the
AbstractAnnotation
class overwrites my changes again while generating the json.swagger-php/src/Annotations/AbstractAnnotation.php
Lines 368 to 386 in a70a5dc
Solution
A possible solution could be to modify above highlighted code with this:
This would make sure to not overwrite our changes from our processor.
The old logic could then be placed inside of an new processor that this package provides.
But then again there might have been a reason why it was not done this way, which I do not know of. I hope hear some thoughts about this and maybe we can find a solution 😄
For now I have simply fallen back to the previous behaviour nelmio/NelmioApiDocBundle#2178
The text was updated successfully, but these errors were encountered: