ExpandAllOf() throws "incompatible properties" if schemas are compatible but not equal
Mantenedores costumam responder em até 1 dia
@mikeharder já está trabalhando nisso.
Desde 3/12/2024.
Avaliação
Esta issue ainda não foi avaliada.
Descrição
The following spec should be valid per JSON Schema and Swagger. However, we throw error incompatible properties when trying to process it, since DogOwner.pet is type Dog, which is compatible with but not equal to PetOwner.pet of type Pet.
@JeffreyRichter, @mikekistler: Do you think the code should be changed to allow types that are compatible but not equal? If so, should it be conditioned on whether the swagger is handwritten or typespec-generated, under the assumption that SDKs for TypeSpec will be generated directly from TypeSpec and not the intermediate Swagger?
We recently fixed a similar issue in https://github.com/Azure/openapi-diff/pull/329, although in this case the types were identical with just an extra step of indirection.
@markcowl and I believe this is valid swagger, but some of our SDK generators may not handle it correctly, which might be why it's not allowed in openapi-diff. However, openapi-diff should not be responsible for this. It should be tested directly by the SDK generation tests.
Repro Steps
Save spec below to file test.json, then run npx @azure/oad test.json test.json.
Error: incompatible properties : pet
definitions/DogOwner/properties/pet
at file:///home/mharder/tmp/oad/test.json#L61:8
definitions/PetOwner/properties/pet
at file:///home/mharder/tmp/oad/test.json#L53:8
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "title",
},
"paths": {
},
"definitions": {
"Pet": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"Dog": {
"type": "object",
"properties": {
"bones": {
"type": "integer"
}
},
"allOf": [{"$ref": "#/definitions/Pet"}]
},
"PetOwner": {
"type": "object",
"properties": {
"ssn": {
"type": "integer"
},
"pet": {
"$ref": "#/definitions/Pet"
}
}
},
"DogOwner": {
"type": "object",
"properties": {
"pet": {
"$ref": "#/definitions/Dog"
}
},
"allOf": [{"$ref": "#/definitions/PetOwner"}]
}
}
}
- Linguagem predominante
- C#
- Estrelas
- 290
- Forks
- 50
- Merge médio
- 7h 8min
- PRs com merge (30d)
- 11
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o 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.
Mais de Azure/openapi-diff
-
Crash if inherited property is structurally equal but not reference identicalTalvez livre de novo @mikeharder assumiu há 158 dias e não há nenhum pull request aberto. Aberta
Azure/openapi-diff#482 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Crash if duplicate model names (across files) used in allOfTalvez livre de novo @mikeharder assumiu há 159 dias e não há nenhum pull request aberto. Aberta
Azure/openapi-diff#479 · 2 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Remove dependency `autorest`Talvez livre de novo @mikeharder assumiu há 221 dias e não há nenhum pull request aberto. Aberta
Azure/openapi-diff#456 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
Azure/openapi-diff#445 ·
Mantenedores costumam responder em até 1 dia
-
OpenAPI-diff should flag changes in the tags for an operationTalvez livre de novo @mikeharder assumiu há 404 dias e não há nenhum pull request aberto. Aberta
Azure/openapi-diff#371 · 7 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de Azure/openapi-diff
Issues semelhantes
-
area:jobads-cv BE mvp P2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
klasolsson81/jobbliggaren#2099 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
0 - Backlog Bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
BrighterCommand/Brighter#4581 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
Esri/calcite-dotnet-toolkit#30 · 1 reação ·
-
kind:docs simplification size:S status:todo
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
elsa-workflows/elsa-foundation#2604 ·
Mantenedores costumam responder em até 1 dia