-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Using 'properties' property name in Model results in it not showing up correctly on the UI models #4228
Comments
I just added one and I did not find any problem: |
@heldersepu Try that UI with these two swagger jsons: https://js-webapptest.azurewebsites.net/swag-working.txt |
What I was trying to proof is that is not just using 'properties' property name in Model... |
Huh, that's kinda funny (okay, maybe not for you, @saarivirtajCGI). It looks like it's when there's a $ref for the value... |
Has there been any progress made on this bug, or is there a known workaround for it? This one's biting us as well. |
I guess the same issue has been reported here: #3091 |
@hctv19 I think the workaround here is obvious: Don't name your property "properties" |
@shockey, thanks for picking this bug up. When do you think this might land on your inner radar circles as we just had a customer report on this issue. |
@shockey I think the correction is simple, we just need to add it to the freelyNamedPaths: |
Hey @shockey, if @heldersepu is correct, I'm happy to send that PR? |
@epet Sure if you have time send a PR, you don't have to ask permission for that... but make sure to include some unit tests, look at the history of that file I added something not too long ago and I included tests, you can use that as a starting point |
@epet - yeah, by all means, open a PR 😄 |
This is probably my lack of understanding nuances of the codebase but I put this test in my change and in the current master, it passes in both versions:
I'm not sure this is solving a problem. @heldersepu or @shockey, advice for better tests or validation for this scenario? |
Bamm. Did the problem got fix? @epet Maybe your unit-test does not actually test the problem, I remember that the first time around I was not able to reproduce, maybe your are on the same boat. |
I just 2check the "notworking.txt" example and the issue still present: |
being a managed code developer, I'm ramping up with the javascript environments. I finally got my changes setup in a local branch with the swagger-ui. Adding 'properties' to the freelyNamedPaths does not solve the issue we are seeing. Open to other ideas or I will pass to let someone with more depth in this codebase fix it. |
@epet I feel your pain! Most of my experience is from managed code as well (.net w/ Visual Studio) one thing that I really miss is the ability to debug UnitTests, cases like this are perfect for a TDD approach, we create a test case reproducing the behavior and on VS we just set a few break-points & start debugging... But so far I have not seen any tool that can help break the VS addiction. |
Just had the same issue after updating from an older version (I think it was something like 3.0.x) to the newest 3.16.0. Because I had this issue in the Swagger editor as well I found #3376 and thought that the newest Swagger UI shouldn't have this issue.. unfortunately after the upgrade I noticed that this issue is back 😢 Really looking forward for a fix as we are not able to rename the property from |
Same issue I'm facing with Swagger editor live demo here https://editor.swagger.io |
Any updates here? |
The following change in https://github.com/swagger-api/swagger-js seems to fix the issue. However I am not sure if that doesn't arise new problems.
|
Demonstration API definition
When you have a property that is named "properties" the UI doesn't seem to respond well to it.
This can be verified by setting a property's name "properties". I've included sample swagger.json files for inspection:
swagger.json with 'properties'
swagger.json with 'properties' renamed to 'xxx'
When the 'properties' is renamed to 'xxx', everything then works as expected.
This visual diff shows the only difference in the spec:
https://i.imgur.com/cGvZOl4.png
Expected Behavior
Should display the models correctly, like this (see 'xxx' / ProductModel):
https://i.imgur.com/uYW1huI.png
https://i.imgur.com/HTViGLA.png
Current Behavior
Apparently because the property is called 'properties', the UI gets confused, and this is what we see:
https://i.imgur.com/IM3oxDw.png
https://i.imgur.com/sc06JKU.png
The property completely disappears from the model, and the type 'Props' is not resolved in the ProductModel, even though it's clearly defined.
Context
Having a property called 'properties' shouldn't break things in my opinion.
The text was updated successfully, but these errors were encountered: