Skip to content
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

JSON Schema contains incorrect property #9373

Closed
SamMousa opened this issue Jan 30, 2025 · 6 comments
Closed

JSON Schema contains incorrect property #9373

SamMousa opened this issue Jan 30, 2025 · 6 comments
Assignees
Labels
bug user issue An issue or bug reported by users

Comments

@SamMousa
Copy link
Contributor

SamMousa commented Jan 30, 2025

Describe the bug
Starting in version .16 (works in .15) the JSON generated JSON schema from const surveySchemas = SurveyCore.Serializer.generateSchema();
incorrectly contains a required type property Panel and descendants (like Page).

Steps to reproduce

https://plnkr.co/edit/597fb2fRoToMekq5

Expected behavior
The JSON schema should not have this property.

@JaneSjs JaneSjs added the user issue An issue or bug reported by users label Feb 4, 2025
@andrewtelnov andrewtelnov self-assigned this Feb 4, 2025
@andrewtelnov
Copy link
Member

@SamMousa Your example was incorrect. I have created a new one. Could you please point what is exactly wrong here?
Page is inherited from Panel now. It allows to render Page as a Panel when needed without re-creating the object itself.

Thank you,
Andrew

@SamMousa
Copy link
Contributor Author

SamMousa commented Feb 4, 2025

Could you please point what is exactly wrong here?

Yes, if you look at the panel definition it has a required property type:

Image

However if you go the survey builder and switch to JSON, the page has no type property. (I think it's an artifact of the Serializer)

In our application we use Monaco Editor and validate the JSON schema, which is how I discovered this bug:

Image

Randomly spotted another error:

Image

I don't think isSinglePage is or should be a property in JSON (since it is a derived value from questionsOnPageMode).

@andrewtelnov
Copy link
Member

@SamMousa Page is inherited from Panel, so it doesn't need to have type, like QuestionText doesn't have type, but Question does.
The problem with isSinglePage is solved by PR above. We should not add non-serializable properties.

Thank you,
Andrew

@SamMousa
Copy link
Contributor Author

SamMousa commented Feb 5, 2025

But type is also not a serializable property for page, correct?

@andrewtelnov
Copy link
Member

Yes, I think it makes sense to remove it for panel as well. We don't need it for panel as well.

@andrewtelnov
Copy link
Member

I removed it by another commit into the same PR.

Thank you,
Andrew

tsv2013 pushed a commit that referenced this issue Feb 5, 2025
* Do not use in generateSchema non-serializable properties #9373

* Remove type from panel
andrewtelnov added a commit that referenced this issue Feb 5, 2025
* Do not use in generateSchema non-serializable properties #9373

* Remove type from panel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug user issue An issue or bug reported by users
Projects
None yet
Development

No branches or pull requests

3 participants