Skip to content

Bug(schema): [Linting issue] unknown keywords w/o x- prefix and $ref siblings in biomaterial_core.json #1626

@Karan-Palan

Description

@Karan-Palan

Give the bug a title

Lint: unknown keywords w/o x- prefix and $ref siblings in biomaterial_core.json

To reproduce

Steps to reproduce the behavior:

  1. From the repo root, install the JSON Schema linter CLI: npm i -g @sourcemeta/jsonschema (or use npx).

  2. In json_schema/core/biomaterial/, run:

    jsonschema lint ./
  3. Observe warnings for unknown_keywords_prefix across multiple fields and a draft_ref_siblings warning.

Schema versions

biomaterial_core.json schema v8.4.0

Observed behavior

The @sourcemeta/jsonschema cli shows these errors/warnings

$ jsonschema lint ./
biomaterial_core.json:10:13:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/name"
biomaterial_core.json:83:30:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/properties/HDBR_accession/user_friendly"
biomaterial_core.json:37:30:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/properties/biomaterial_description/user_friendly"
biomaterial_core.json:27:30:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/properties/biomaterial_id/user_friendly"
biomaterial_core.json:32:30:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/properties/biomaterial_name/user_friendly"
biomaterial_core.json:67:30:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/properties/biosamples_accession/user_friendly"
biomaterial_core.json:51:30:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/properties/genotype/user_friendly"
biomaterial_core.json:75:30:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/properties/insdc_sample_accession/user_friendly"
biomaterial_core.json:45:30:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/properties/ncbi_taxon_id/user_friendly"
biomaterial_core.json:22:24:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/properties/schema_version/example"
biomaterial_core.json:60:30:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/properties/supplementary_files/user_friendly"
biomaterial_core.json:88:28:
  In Draft 7 and older dialects, keywords sibling to `$ref` are never evaluated (draft_ref_siblings)
    at schema location "/properties/timecourse/description"
biomaterial_core.json:91:30:
  Future versions of JSON Schema will refuse to evaluate unknown keywords that don't have an x- prefix (unknown_keywords_prefix)
    at schema location "/properties/timecourse/user_friendly"

Expected behavior

Ideally there should not be any linting errors in the schema. We can fix it with jsonschema lint {file/dir} --fix

Screenshots or Messages

Image

Note

For context, I, along with Juan (JSON Schema TSC member) are defining linting rules for JSON Schema as a Part of a GSoC (Google Summer of code) project here - https://github.com/Karan-Palan/JSON-Schema-Linting, and implementing their auto-fixes here - https://github.com/sourcemeta/jsonschema/blob/main/docs/lint.markdown. We have recently added many rules prefixing unknown keywords with x- which will be introduced in the newer JSON Schema drafts
If beneficial to the project, I suggest integrating the complete cli with it to write the best schemas and catch any errors and follow best practices. Examples of integration - https://github.com/krakend/krakend-schema/blob/main/.github/workflows/validate-json-schema.yml#L10

You can find the health of schemas here:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug in metadata schema, code, or examples.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions