Azure / Azure/openapi-diff

Crash if inherited property is structurally equal but not reference identical

Abierto
#482 0 comentarios 0 reacciones 1 asignado Reclamado por @mikeharder Ver en GitHub
Lenguaje dominante
C#
Estrellas
290
Forks
50
Merge medio
5 d 13 h
PR fusionados (30 d)
5

Descripción

If a definition defines a property, and inherits from another definition that also defines the property:

- If the properties are reference identical, it's allowed
- If the properties are equivalent (but not reference identical), the tool crashes

## Organic PRs hitting problem
- https://github.com/Azure/azure-rest-api-specs/actions/runs/25541171453

## Test Cases

- https://github.com/Azure/openapi-diff/pull/481

### Pass - Reference Identical

```json
{
"swagger": "2.0",
"info": {
"title": "structural-equality",
"version": "1.0"
},
"paths": {},
"definitions": {
"Foo": {
"type": "object",
"properties": {
"bar": {
"$ref": "#/definitions/MyObject"
}
},
"allOf": [
{
"$ref": "#/definitions/Foo2"
}
]
},
"Foo2": {
"type": "object",
"properties": {
"bar": {
"$ref": "#/definitions/MyObject"
}
}
},
"MyObject": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
```

### Fail - Structurally Equal
```json
{
"swagger": "2.0",
"info": {
"title": "structural-equality",
"version": "1.0"
},
"paths": {},
"definitions": {
"Foo": {
"type": "object",
"properties": {
"bar": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"allOf": [
{
"$ref": "#/definitions/Foo2"
}
]
},
"Foo2": {
"type": "object",
"properties": {
"bar": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
```

### Error
```
incompatible properties : bar
definitions/Foo/properties/bar
at file:///home/mharder/openapi-diff-mh/incompat-prop/src/test/specs/incompatible-properties/structural-equality-fail.json#L12:8
definitions/Foo2/properties/bar
at file:///home/mharder/openapi-diff-mh/incompat-prop/src/test/specs/incompatible-properties/structural-equality-fail.json#L28:8
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.