[Schema Inaccuracy] `git-tree` schema has no required properties

Abierto
#3,833 1 comentario 5 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
github, openapi
Área
api

Línea de trabajo

Comienza ubicando el esquema git-tree en la descripción de la API REST e inspecciona su propiedad tree y su ejemplo. Compáralos con los campos obligatorios y el contenido del ejemplo esperados por el issue, y después verifica que el esquema resultante produzca los tipos descendentes previstos.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

documentation

Schema Inaccuracy

The tree property in the git-tree schema has no required fields. I believe this is inaccurate.

Additionally, the example field of the tree property appears to have incorrect data, as it includes a properties field and a required field. I'm guessing these were mistakenly copy/pasted at some point. My guess is that the required field from the example was intended to be in the tree property, making those fields required.

This matters to me because the downstream @octokit/openapi-types package that is generated from this definition lists every property as optional, forcing me to check for the existence of every single property on every single node.

Expected

  1. The path, mode, type, and sha fields should be required on the git-tree schema. (size appears to be absent on directories and submodules, and url appears to be absent on submodules)
  2. The properties and required fields should be removed from the git-tree schema's example.

Also, if you're feeling generous, you can update the types of type and mode to be enums, as laid out in #229 - it's the same exact schema!

Reproduction Steps

It's tough to prove that these properties will always be present, but I created this repo with every possible node type/mode combination, at least according to these docs. If you curl the tree for this repo, you'll see that every tree node has the path, mode, type and sha properties.

curl https://api.github.com/repos/rpmccarter/every-node-type/git/trees/main
Lenguaje dominante
Sin datos de lenguaje
Estrellas
1.6k
Forks
342
Merge medio
3 h 33 min
PR fusionados (30 d)
51

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de github/rest-api-description

Todos los issues de github/rest-api-description

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.