Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Infer field type from const value #1174

Merged
merged 1 commit into from
Feb 8, 2019
Merged

Infer field type from const value #1174

merged 1 commit into from
Feb 8, 2019

Conversation

LucianBuzzo
Copy link
Collaborator

@LucianBuzzo LucianBuzzo commented Feb 7, 2019

This change adds support for schemas that use the const keyword
without and adjacent type keyword. For example:

{
  "type": "object",
  "properties": {
    "firstName": {
      "const": "Chuck"
    }
  }
}

Signed-off-by: Lucian lucian.buzzo@gmail.com

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests
    • I've updated docs if needed
    • I've run npm run cs-format on my branch to conform my code to prettier coding style
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

Copy link
Member

@epicfaace epicfaace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I think it might be good to add a test for a const equal to a boolean and make sure the checkbox widget is rendered?

This change adds support for schemas that use the `const` keyword
without and adjacent `type` keyword. For example:

```json
{
  "type": "object",
  "properties": {
    "firstName": {
      "const": "Chuck"
    }
  }
}
```

Signed-off-by: Lucian <lucian.buzzo@gmail.com>
@LucianBuzzo
Copy link
Collaborator Author

@epicfaace Good idea, I've added the test

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

Successfully merging this pull request may close these issues.

3 participants