Skip to content

Commit

Permalink
Merge pull request #1084 from pmcelhaney/disable-fill-properties-json…
Browse files Browse the repository at this point in the history
…-schema

feat(server): Update JSONSchemaFaker not to create fake object properties
  • Loading branch information
dethell authored Oct 17, 2024
2 parents 178f4e7 + 707a0ec commit d60c90d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-numbers-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"counterfact": patch
---

Updates JSONSchemaFaker to have the fillProperties option false so it will not make up fake object properties
1 change: 1 addition & 0 deletions src/server/response-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ JSONSchemaFaker.option("minItems", 0);
JSONSchemaFaker.option("maxItems", 20);
JSONSchemaFaker.option("failOnInvalidTypes", false);
JSONSchemaFaker.option("failOnInvalidFormat", false);
JSONSchemaFaker.option("fillProperties", false);

function convertToXmlIfNecessary(
type: string,
Expand Down
1 change: 1 addition & 0 deletions src/server/tools.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { JSONSchemaFaker, type Schema } from "json-schema-faker";

JSONSchemaFaker.option("useExamplesValue", true);
JSONSchemaFaker.option("fillProperties", false);

export class Tools {
private readonly headers: { [key: string]: string[] | string | undefined };
Expand Down

0 comments on commit d60c90d

Please sign in to comment.