microsoft / microsoft/OpenAPI.NET
Add support for $schema and jsonSchemaDialect
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C#
- Estrellas
- 1.6k
- Forks
- 286
- Merge medio
- 6 h 38 min
- PR fusionados (30 d)
- 35
Descripción
In today's implementation (2.11.0, 3.9.0), the deserialization and serialization of JSON Schemas is effectively hard-coded to 2020-12.
However, starting with OpenAPI 3.1, people can set the $schema property of any given schema to a different dialect (default being documented here.
This entails a couple of things:
- parsing that keyword first if it exists, or falling back on the document dialect property, or falling back to the default value for the OpenAPI version.
- if that value is known (like
https://spec.openapis.org/oas/3.1/dialect/baseusing the parsing logic associated with that entry - if that value is unknown, we need to load the corresponding schema, and read its schema (recursively) until we find a known value. (note be careful of the security considerations here)
Note: ideally we'd make the OpenAPISchema type generic and allow the caller to provide new registrations of schemas uris with the corresponding parsing logic and data type, but that'd introduce major breaking changes, making the cost prohibitive.
That update will most likely require introducing a JSON Schema service of some kind in charge of mapping the known schemas with their deserialization logic, and having the OpenAPISchema deserializers call into that service.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza rastreando los deserializadores y serializadores de OpenAPISchema e identificando dónde se aplica la suposición 2020-12. Define el servicio de JSON Schema en torno al registro de dialectos, la resolución de fallback, el manejo recursivo de esquemas desconocidos y las restricciones de seguridad; se considera terminado cuando $schema y jsonSchemaDialect seleccionan el dialecto conocido o cargado correcto sin romper el comportamiento existente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- csharp, openapi
- Área
- api, backend-api-design
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100