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

Default oaSchemaProp on Enum Strings throws an error #1761

Open
amoghsharma1996 opened this issue Dec 17, 2021 · 1 comment
Open

Default oaSchemaProp on Enum Strings throws an error #1761

amoghsharma1996 opened this issue Dec 17, 2021 · 1 comment

Comments

@amoghsharma1996
Copy link

amoghsharma1996 commented Dec 17, 2021

Question on the example prop. Not sure if this is a bug or something I am misunderstanding

An example code block like this:

  /** Status
   * @oaSchemaProp default
   * "Active"
   */
  // prettier-ignore
  status: "Active" | "Inactive";

When generating the contract, this throws an error like:

Error: property must be compliant with union type or property not allowed

Is this not a valid piece of documentation? This works if status is of type String but the whole point is to have Status limited to certain specific string values and to tell the user what it defaults to. The example prop does not throw an error in this same case but there is definitely a difference between example and default in terms of messaging to the user. Any thoughts?

Hopefully doesn't matter but I am on Node v12.18.3 and using the latest version of Spot @1.9.0

Edit: the issue is still prevalent when trying to use @default "Active"

@amoghsharma1996
Copy link
Author

Still an issue, have resolved to using the example prop instead of default prop but those obviously don't actually mean the same thing! Anyone have any thoughts?

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