Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Support xs-ms-enum values without the "value" label

Abierto
#216 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
csharp
Área
api, devtools

Línea de trabajo

Empieza inspeccionando XmsEnumExtension y XmsEnumValue y, a continuación, reproduce el fallo de deserialización de Newtonsoft.Json con el JSON x-ms-enum mostrado en la ruta de comparación de OpenApi-Diff. Se considera terminado cuando las entradas de enum representadas como valores primitivos, incluidos 3, 4 y 5, se deserializan y comparan sin lanzar una JsonSerializationException.

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

Descripción

Some contract generators define the values of x-ms-enum as a list of actual values without labels.
The current version OpenApi-Diff doesn't support this format and throws a Newtonsoft.Json.JsonSerializationException in this case.

Example of x-ms-enum with and without the "value" label
"enum": [ "Mammals", "Fish", "Birds", "Reptiles", "Amphibians", "Invertebrates" ], "type": "string", "x-ms-enum": { "name": "PetType", "modelAsString": false, "values": [ { "value": 0, "description": "humans and all other animals that are warm-blooded vertebrates", "name": "Mammals" }, { "value": 1, "description": "aquatic, craniate, gill-bearing animals that lack limbs with digits" }, { "value": 2, "name": "Birds" }, 3, 4, 5 ], "x-nullable": false }

The issue with this XmsEnumExtension is that we cannot cast an object of primitive type (e.g. long, string) to a XmsEnumValue , thus all contracts that contains x-ms-enum with a list of values of primitive type causes a deserialization issue in the OpenApiDiff comparison.

The exception is the following

Newtonsoft.Json.JsonSerializationException : Error converting value 3 to type 'AutoRest.Swagger.Model.XmsEnumValue'. Path 'definitions.PetType.x-ms-enum.values[0]', line 235, position 11.
  ----> System.ArgumentException : Could not cast or convert from System.Int64 to AutoRest.Swagger.Model.XmsEnumValue.
Lenguaje dominante
C#
Estrellas
290
Forks
50
Merge medio
2 d 21 h
PR fusionados (30 d)
10

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 Azure/openapi-diff

Todos los issues de Azure/openapi-diff

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.