Skip to content

Fix non-deterministic example generation for additionalProperties when schemaFaker is disabled#926

Open
Aggarwalmansi wants to merge 1 commit intopostmanlabs:developfrom
Aggarwalmansi:fix/schemaFaker-deterministic-additionalProperties
Open

Fix non-deterministic example generation for additionalProperties when schemaFaker is disabled#926
Aggarwalmansi wants to merge 1 commit intopostmanlabs:developfrom
Aggarwalmansi:fix/schemaFaker-deterministic-additionalProperties

Conversation

@Aggarwalmansi
Copy link
Copy Markdown

Problem

When converting OpenAPI schemas using openapi-to-postmanv2, setting
schemaFaker: false is expected to produce deterministic examples.

Currently, schemas that contain additionalProperties still result in
random property names and values being generated across runs (for example,
amet_04, sit_2, etc.). This makes the output non-deterministic even
when schema faking is explicitly disabled.

This is most noticeable for object schemas that rely on
additionalProperties rather than explicitly defined fields.


Root Cause

While schemaFaker is disabled, example generation for object schemas
with additionalProperties still falls back to faker-based logic.
As a result, random keys and values are produced instead of stable
schema placeholders.


Solution

This change adds a deterministic fallback for object schemas that use
additionalProperties when schemaFaker is set to false.

  • Faker-based generation is skipped in this case
  • A stable placeholder object (for example "<property>": "<string>")
    is returned instead
  • Existing behavior remains unchanged when schemaFaker is enabled
  • Schemas without additionalProperties are not affected

Impact

This ensures consistent and repeatable Postman collections when
schemaFaker: false is used, avoiding unnecessary diffs and improving
reliability in CI/CD and version-controlled workflows.


Related Issue

Fixes #854

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

schemaFaker: false Still Generates Random Values

1 participant