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 annotation support #569

Closed
ghost opened this issue Aug 5, 2019 · 1 comment
Closed

default annotation support #569

ghost opened this issue Aug 5, 2019 · 1 comment
Assignees
Labels
Type: Feature New features and feature requests

Comments

@ghost
Copy link

ghost commented Aug 5, 2019

According to JSON Schema (draft-07) there are default annotation for the default values. Following JSON Schema do not generate default values in the playground: https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.2.

{
  "$id": "https://example.com/arrays.schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "description": "A representation of a person, company, organization, or place",
  "type": "object",
  "default": {"fruits":["some fruit"]},
  "properties": {
    "fruits": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "vegetables": {
      "type": "array",
      "items": { "$ref": "#/definitions/veggie" }
    }
  },
  "definitions": {
    "veggie": {
      "type": "object",
      "required": [ "veggieName", "veggieLike" ],
      "default": {"veggieName": "some veggie"},
      "properties": {
        "veggieName": {
          "type": "string",
          "description": "The name of the vegetable."
        },
        "veggieLike": {
          "type": "boolean",
          "description": "Do I like this vegetable?"
        }
      }
    }
  }
}

Though the same functionality works ok (defaults are set) in brutusin:json-forms if you try it.

@radekmie radekmie self-assigned this Aug 5, 2019
@radekmie radekmie added the Type: Feature New features and feature requests label Aug 5, 2019
@radekmie
Copy link
Contributor

radekmie commented Aug 5, 2019

Hi @dealancer. True, it doesn't resolve top-level and $refed default values. I'll take a look into that.

@radekmie radekmie moved this to Closed in Open Source Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New features and feature requests
Projects
Archived in project
Development

No branches or pull requests

1 participant