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

infinity recursion #625

Open
knorVV opened this issue Jul 31, 2024 · 0 comments
Open

infinity recursion #625

knorVV opened this issue Jul 31, 2024 · 0 comments
Labels

Comments

@knorVV
Copy link

knorVV commented Jul 31, 2024

Hi! The function OpenApiSpex.Schema.example/2 start infinity recursion when we using schemas like this.

{
  "components": {
    "schemas": {
      "Schema": {
        "properties": {
          "next_node": {
            "$ref": "#/components/schemas/Schema1",
            "x-name": "next_node",
            "x-order": 2
          },
          "value": {
            "type": "integer",
            "x-name": "value",
            "x-order": 1
          }
        },
        "type": "object"
      },
      "Schema1": {
        "properties": {
          "next_node": {
            "$ref": "#/components/schemas/Schema",
            "x-name": "next_node",
            "x-order": 3
          },
          "value": {
            "type": "integer",
            "x-name": "value",
            "x-order": 4
          }
        },
        "type": "object"
      }
    }
  },
  "openapi": "3.0.0",
  "paths": {},
  "servers": []
}

For example

schema = {
        "properties": {
          "next_node": {
            "$ref": "#/components/schemas/Schema1",
            "x-name": "next_node",
            "x-order": 2
          },
          "value": {
            "type": "integer",
            "x-name": "value",
            "x-order": 1
          }
        }

schemas = {
      "Schema": {
        "properties": {
          "next_node": {
            "$ref": "#/components/schemas/Schema1",
            "x-name": "next_node",
            "x-order": 2
          },
          "value": {
            "type": "integer",
            "x-name": "value",
            "x-order": 1
          }
        },
        "type": "object"
      },
      "Schema1": {
        "properties": {
          "next_node": {
            "$ref": "#/components/schemas/Schema",
            "x-name": "next_node",
            "x-order": 3
          },
          "value": {
            "type": "integer",
            "x-name": "value",
            "x-order": 4
          }
        },
        "type": "object"
      }
    }

OpenApiSpex.Schema.example(schema, schemas)

Is there any solution for this? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants