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

Possibly wrong enum name #339

Closed
jatsqi opened this issue Sep 21, 2020 · 1 comment
Closed

Possibly wrong enum name #339

jatsqi opened this issue Sep 21, 2020 · 1 comment
Labels

Comments

@jatsqi
Copy link

jatsqi commented Sep 21, 2020

My input json schema looks like this:

  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "type": "object",
  "title": "EntityObjectDefinition",
  "properties": {
    "definitions": {
      "type": "object",
      "additionalProperties": false,
      "minProperties": 1,
      "patternProperties": {
        "^[a-zA-Z0-9_. /]+$": {
          "type": "object",
          "$ref": "#/definitions/EntityObject"
        }
      }
    }
  },
  "definitions": {
    "EntityObject": {
      "type": "object",
      "description": "My example entity object definition",
      "required": ["EntityDataCategory"],
      "properties": {
        "EntityDataCategory": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "APorpertyName": {
              "$ref": "#/definitions/EntityDataCategory"
            }
          }
        }
      }
    },
    "EntityDataCategory": {
      "type": "string",
      "enum": [
        "TABLE",
        "OBJ",
        "FUNC"
      ],
      "tsEnumNames": [
        "Table",
        "Field",
        "Func"
      ]
    }
  }
}

The interesting thing about this schema is this part:
"APorpertyName": { "$ref": "#/definitions/EntityDataCategory" }
The problem here is that the I expected an Enum 'EntityDataCategory' to be generated, but the name of the enum is always 'APorpertyName' which is something I want to avoid.
Is this a bug in the current library version or is this the correct behavior and I misunderstand something?

@jatsqi jatsqi changed the title Wrong enum name problem Possibly wrong enum name Sep 21, 2020
@bcherny bcherny added the bug label Nov 29, 2020
@bcherny
Copy link
Owner

bcherny commented Nov 29, 2020

Thanks for the report!

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