microsoft / microsoft/OpenAPI.NET
Add support for $schema and jsonSchemaDialect
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- C#
- Estrelas
- 1.6k
- Forks
- 286
- Merge médio
- 6h 38min
- PRs com merge (30d)
- 35
Descrição
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.
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece rastreando os desserializadores e serializadores de OpenAPISchema e identificando onde a suposição 2020-12 é aplicada. Defina o serviço JSON Schema em torno do registro de dialetos, da resolução de fallback, do tratamento recursivo de schemas desconhecidos e das restrições de segurança; considera-se concluído quando $schema e jsonSchemaDialect selecionarem o dialeto conhecido ou carregado correto sem quebrar o comportamento existente.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- csharp, openapi
- Domínio
- api, backend-api-design
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Ativa
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100