Conversation
…es with prism-cli set json-schema-faker options (x-json-schema-faker, the --json-schema-faker-fillProperties flag) on its own import of json-schema-faker. Since stoplightio#2754 bumped only the CLI's copy to 0.5.9 while prism-http stayed on 0.5.8, two copies are installed and the CLI has been configuring an instance the generator never reads. Every option, including locale and fillProperties, was a silent no-op. Move option setting into prism-http next to resetGenerator and export it as setJSONSchemaGeneratorOption, so the CLI can only ever configure the instance that generates responses. Drop the CLI's direct json-schema-faker dependency. Closes stoplightio#2683
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b02bf15a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Disabling fillProperties switched useDefaultValue on but re-enabling it never switched it back, so a CLI override of a spec-level fillProperties: false kept substituting schema defaults. Track the option both ways, and leave useDefaultValue alone when the user set it explicitly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #2683
Summary
prism-cliappliedx-json-schema-fakeroptions and--json-schema-faker-fillPropertiesto its own import ofjson-schema-faker. #2754 bumped only the CLI's dependency to 0.5.9 whileprism-httpstayed on 0.5.8, so npm installs two copies. The CLI has been configuring an instance the response generator never reads, and every faker option has been a silent no-op since 5.12 (Docker image, npm install, and the monorepo alike).Visible symptom:
prism mock -d --json-schema-faker-fillProperties=falsestill pads objects withoutadditionalProperties: falsewith random lorem-ipsum properties such as"deserunt_f": "eu esse".This moves option setting into
prism-httpnext toresetGeneratorand exports it assetJSONSchemaGeneratorOption. The CLI calls that instead of touchingjson-schema-fakerdirectly, and its direct dependency onjson-schema-fakeris removed. A future version skew can no longer split the instances.Verified with the built CLI against a real OpenAPI document: with the flag, responses contain exactly the declared properties across repeated calls; without it, the random extras still appear.
Checklist
Additional context
New tests:
packages/cli/src/__tests__/extensions.spec.ts(fails onmain, passes here) coversx-json-schema-faker, the CLI parameter, and CLI precedence, all asserted against the generatorprism-httpuses.packages/httpgains afillPropertiesdisabled case.