You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.
In my fix-arrays-in-map branch I have a file called maps.yaml which causes some problems for swagger-parser.
I came across this problem when I started using swagger-tester to test the API generated by Swashbuckle (a C# library to auto-generate swagger api from class definitions). In that, I specified a series of classes which generated the yaml similar to what you see in maps.yaml. Even though the file is slightly different from what was auto-generated, the takeway is the use of properties instead of additionalProperties.
The two things I noticed swagger-parser struggling with were:
The expected value of an entry in a map is meant to be a list but is instead flattened to a single object.
The entire return result which is meant to be an object is turned into a list.
My biggest concern with my change is the code I've commented out. I expect a list to be returned from that function but it's specifically coded against and reinforced by a comment. I'm hoping @jfinkhaeuser can comment on this and possibly provide an example of a definition that would break my proposed change.
EDIT: This whole section needs a rethink
Also, while trying to fix this problem I noticed one of the current tests may be incorrect. If I understand the definition in the test correctly, the assert on line 125 should be checking for an object, not a list.
I haven't created a pull request because I'm not convinced I'm writing my yaml correctly. It validates without any problems but the expected return value swagger-parser generates is different to what I expected. If someone could critique my proposed changes and provide any input/guidance, that would be great.
Thanks.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In my fix-arrays-in-map branch I have a file called maps.yaml which causes some problems for swagger-parser.
I came across this problem when I started using swagger-tester to test the API generated by Swashbuckle (a C# library to auto-generate swagger api from class definitions). In that, I specified a series of classes which generated the yaml similar to what you see in maps.yaml. Even though the file is slightly different from what was auto-generated, the takeway is the use of properties instead of additionalProperties.
The two things I noticed swagger-parser struggling with were:
If my yaml file is indeed correct and should be returning the data I've specified in the tests I've added. The potential fix is in https://github.com/vinnier/swagger-parser/commit/df47a883da4bdf1f617d7e97b5b93ace9f9ca4af.My biggest concern with my change is the code I've commented out. I expect a list to be returned from that function but it's specifically coded against and reinforced by a comment. I'm hoping @jfinkhaeuser can comment on this and possibly provide an example of a definition that would break my proposed change.EDIT: This whole section needs a rethink
Also, while trying to fix this problem I noticed one of the current tests may be incorrect. If I understand the definition in the test correctly, the assert on line 125 should be checking for an object, not a list.
I haven't created a pull request because I'm not convinced I'm writing my yaml correctly. It validates without any problems but the expected return value swagger-parser generates is different to what I expected. If someone could critique my proposed changes and provide any input/guidance, that would be great.
Thanks.
The text was updated successfully, but these errors were encountered: