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

fix(mocks): use original name of ref schema in ref resolution #1510

Merged

Conversation

GMusk
Copy link
Contributor

@GMusk GMusk commented Jul 9, 2024

Use original name of referenced schema in ref resolution

fix #1500

Status

READY

Description

  • Resolves an issue where the maximum call stack is exceed when using circular dependencies in schema.
  • The mock scalar function uses the existingReferencedProperties variable to maintain a list of visited schema items.
  • The name provided from the resolveValue function uses the ref's value as pascalCase instead of the original name.
  • This would cause an infinite loop as the visited ref object isn't recognised as being visited.
  • Fixed by using the original name in schema ref resolution.

Steps to Test or Reproduce

  1. Generate mocks from a schema that includes a ref to a component with a lower case name.
  2. Check it doesn't fail.

…f resolution

use original name of referenced schema in ref resolution

fix orval-labs#1500
@melloware melloware added the mock Related to mock generation label Jul 9, 2024
@melloware melloware merged commit 916e277 into orval-labs:master Jul 9, 2024
2 checks passed
@GMusk GMusk deleted the fix/mocking-circular-dependencies branch July 9, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mock Related to mock generation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Range error when using nested $ref in schema.json
2 participants