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

Decycle produce a wrong schema for schemas with description #727

Open
juneidy opened this issue Apr 19, 2024 · 0 comments
Open

Decycle produce a wrong schema for schemas with description #727

juneidy opened this issue Apr 19, 2024 · 0 comments

Comments

@juneidy
Copy link

juneidy commented Apr 19, 2024

The original schema:

{
  "title": "Request",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "requestBody": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "active": {
          "description": "Active style.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "foo": {
              "type": "string"
            }
          }
        },
        "default": {
          "description": "Default style.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "foo": {
              "type": "string"
            }
          }
        }
      }
    }
  },
  "required": [
    "requestBody"
  ]
}

The decycled schema:

{
  "title": "Request",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "requestBody": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "active": {
          "description": "Active style.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "foo": {
              "type": "string"
            }
          }
        },
        "default": {
          "description": "Default style.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "$ref": "#/properties/requestBody/properties/active/properties"
          }
        }
      }
    }
  },
  "required": [
    "requestBody"
  ]
}

I would imagine the correct result should be something like:

{
  "title": "Request",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "requestBody": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "active": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "foo": {
              "type": "string"
            }
          },
          "description": "Style definition."
        },
        "default": {
          "$ref": "#/properties/requestBody/properties/active"
        }
      }
    }
  },
  "required": [
    "requestBody"
  ]
}
@juneidy juneidy changed the title Decycle produce a wrong schema for schemas with definition Decycle produce a wrong schema for schemas with description Apr 22, 2024
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

No branches or pull requests

1 participant