Skip to content

Conversation

@HansMartinJ
Copy link

Why: For some complex schemas, the mock library hangs because of this option is true.

This is possibly because of a bug leading to an infinite loop, or because the nature of the schema leading to exponential amount of optional fields to be generated

Setting alwaysFakeOptionals to false fixes this issue for the schema that caused the error

  • Breaking change? (if so, please describe the impact and migration path for existing application instances)

What changes did you make? (Give an overview)
Set alwaysFakeOptionals=false

Is there anything you'd like reviewers to focus on?
I understand there is a tradeoff here, but it completely breaks some of our topic, so it would be great if it could be merged.

Also note that the schema mocker for some reason runs on the main topic page load (not just by clicking on produce)
So it stops the topic completely from being accessed.

How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)

  • No need to
  • Manually (please, describe, if necessary)
  • Unit checks
  • Integration checks
  • Covered by existing automation

Tested the schema locally with the schema mock library, tried with and without this option, where without the schema generated fine

Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. ENVIRONMENT VARIABLES)
  • My changes generate no new warnings (e.g. Sonar is happy)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Check out Contributing and Code of Conduct

A picture of a cute animal (not mandatory but encouraged)
🦭

Why: For some complex schemas, the mock library hangs.

This is possibly because of a bug leading to an infinite loop, or more probably because the nature of the schema leading to exponential amount of optional fields to be generated

Setting alwaysFakeOptionals to false fixes this issue for the schema that caused the error
@HansMartinJ HansMartinJ requested a review from a team as a code owner September 25, 2025 12:00
@kapybro kapybro bot added status/triage Issues pending maintainers triage status/triage/manual Manual triage in progress status/triage/completed Automatic triage completed and removed status/triage Issues pending maintainers triage labels Sep 25, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi HansMartinJ! 👋

Welcome, and thank you for opening your first PR in the repo!

Please wait for triaging by our maintainers.

Please take a look at our contributing guide.

@Haarolean
Copy link
Member

@HansMartinJ is that possible to cover this with a test?

@HansMartinJ
Copy link
Author

@HansMartinJ is that possible to cover this with a test?

Not sure, I can't share the schema that caused it. We have a fork that we can fix it in so you may close this if needs more work, then you know the fix if it ever comes up again :)

@Haarolean
Copy link
Member

@HansMartinJ is that possible to cover this with a test?

Not sure, I can't share the schema that caused it. We have a fork that we can fix it in so you may close this if needs more work, then you know the fix if it ever comes up again :)

I don't mind merging this but a test would be nice so we don't get a regression later. Couldn't you anonimize fields in the schema?

@HansMartinJ
Copy link
Author

The schema is massive so its hard to fake it all

Anyways i think this is a bad solution, because we actually had to also had to add the following as well to fix the massive schema (like 9000000 fields were created even without fake optionals)
jsf.option('maxItems', 5);

It may be better to expose the mock schema options to the user to give more control.

I'm closing it because it only a half-solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/triage/completed Automatic triage completed status/triage/manual Manual triage in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants