Skip to content

Mark recommended fields #18

@sbliven

Description

@sbliven

LinkML can mark fields as recommended: true, which is treated by validators as required:false but can be used by the UI to give warnings to users for missing fields. Should we make user-specified fields (like sample info) recommended rather than required? This could be a compromise to support automatic acquisition while still pushing users to fill out important fields.

Example

name: test-schema
id: http://example.org/test-schema
imports:
- linkml:types
prefixes:
  linkml: https://w3id.org/linkml/
  test_schema: http://example.org/test-schema/
default_prefix: test_schema
default_range: string
slots:
  required:
    range: string
    required: true
  recommended:
    range: string
    recommended: true
  optional:
    ifabsent: string(default value)
    range: string
    required: false
classes:
  Test:
    slots:
    - required
    - recommended
    - optional

The property is preserved in JSON Schema:

{
    "$defs": {
        "Test": {
            "additionalProperties": false,
            "description": "",
            "properties": {
                "optional": {
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "recommended": {
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "required": {
                    "type": "string"
                }
            },
            "required": [
                "required"
            ],
            "title": "Test",
            "type": "object"
        }
    },
    "$id": "http://example.org/test-schema",
    "$schema": "https://json-schema.org/draft/2019-09/schema",
    "additionalProperties": true,
    "metamodel_version": "1.7.0",
    "title": "test-schema",
    "type": "object",
    "version": null
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions