Add schema practices and a JSON Schema ecosystem profile

Aberta
#85 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
46/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
json, python
Domínio
testing, tooling

Direção de pesquisa

Start with project_validator/rules.py to see how rule types are defined, then read tests/test_ecosystem_contract.py and the language profile implementation for the existing contract pattern. Add the JSON Schema profile and the four checks described in the issue; the fixtures should show that a well configured schema passes and a bare schema is reported appropriately. Keep --validate-data out of scope.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Checks

New practices, each a rule type in project_validator/rules.py, first supplied by a JSON Schema profile:

Check Passes when
schema-declared every schema names its dialect ($schema) and has an $id; a dialect older than draft 2019-09 warns
schema-validation CI validates the instance documents against their schemas: check-jsonschema, ajv-cli, the jsonschema CLI, jv
schema-examples the schemas come with examples that CI validates: valid ones that must pass and invalid ones that must fail (e.g. examples/valid, examples/invalid, or a test suite)
schema-compatibility CI checks schema changes for breaking changes (json-schema-diff or an equivalent) (warning-level)

Profile

JSON Schema: recognised by intent only, never by plain .json files (#63): *.schema.json, or a top-level $schema naming json-schema.org. code-formatting: prettier or biome. Language practices (coverage, platform-matrix, ...) have no rule and report SKIP.

Later

An optional deep mode, --validate-data, could validate instances against their schemas itself, with jsonschema as an optional dependency like rich (see the Dependency Policy). It follows --build as a precedent and is not part of this issue.

Definition of done

As for language profiles: well_configured_json_schema and bare_json_schema fixtures held by tests/test_ecosystem_contract.py. data-wellformed (#84) already covers schemas that do not parse.

Linguagem predominante
Python
Estrelas
4
Forks
1
Merge médio
10h 41min
PRs com merge (30d)
79

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de cpp-best-practices/project_validator

Todas as issues de cpp-best-practices/project_validator

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.