Skip to content

Infer field type from const value#1174

Merged
epicfaace merged 1 commit intomasterfrom
const-support
Feb 8, 2019
Merged

Infer field type from const value#1174
epicfaace merged 1 commit intomasterfrom
const-support

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

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

Successfully merging this pull request may close these issues.

3 participants