[Bug]: Kiota generation is weird because of the OpenAPI scheme
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- csharp, openapi
- Área
- api, backend-api-design
Línea de trabajo
Reproduce el problema con el esquema de respuesta OpenAPI proporcionado y Kiota 1.6.77; después, rastrea los tipos de respuesta C# generados y el código fuente que construye esta operación OpenAPI. Compara las sobrecargas generadas con el esquema de colección explícito propuesto; se considera terminado cuando la respuesta está representada por el modelo tipado previsto y ya no incluye el método duplicado obsoleto.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happened?
For a simple orders table, I get this path in the OpenAPI document
"/Order": {
"get": {
"tags": [
"Order"
],
"description": "Returns entities.",
"parameters": [
{
"name": "X-MS-API-ROLE",
"in": "header",
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
}
},
{
"name": "$select",
"in": "query",
"description": "A comma separated list of fields to return in the response.",
"schema": {
"type": "string"
}
},
{
"name": "$filter",
"in": "query",
"description": "An OData expression (an expression that returns a boolean value) using the entity's fields to retrieve a subset of the results.",
"schema": {
"type": "string"
}
},
{
"name": "$orderby",
"in": "query",
"description": "Uses a comma-separated list of expressions to sort response items. Add 'desc' for descending order, otherwise it's ascending by default.",
"schema": {
"type": "string"
}
},
{
"name": "$first",
"in": "query",
"description": "An integer value that specifies the number of items to return. Default is 100.",
"schema": {
"type": "integer"
}
},
{
"name": "$after",
"in": "query",
"description": "An opaque string that specifies the cursor position after which results should be returned.",
"schema": {
"type": "string"
}
}
],
"responses": {
"400": {
"description": "BadRequest"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "NotFound"
},
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Order"
}
},
"nextLink": {
"type": "string"
}
}
}
}
}
}
}
},
"post": {
"tags": [
"Order"
],
"description": "Create entity.",
"parameters": [
{
"name": "X-MS-API-ROLE",
"in": "header",
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Order_NoAutoPK"
}
}
},
"required": true
},
"responses": {
"400": {
"description": "BadRequest"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "NotFound"
},
"201": {
"description": "Created",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Order"
}
}
}
}
}
}
},
"409": {
"description": "Conflict"
}
}
}
}
Then I run Kiota in the document and I get the following
[Obsolete("This method is obsolete. Use GetAsOrderGetResponseAsync instead.")]
public async Task<global::TestSimple.Client.Order.OrderResponse?> GetAsync(Action<RequestConfiguration<global::TestSimple.Client.Order.OrderRequestBuilder.OrderRequestBuilderGetQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) { /*stuff*/}
public async Task<global::TestSimple.Client.Order.OrderGetResponse?> GetAsOrderGetResponseAsync(Action<RequestConfiguration<global::TestSimple.Client.Order.OrderRequestBuilder.OrderRequestBuilderGetQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) { /* stuff */}
From what I understood, this is a problem on the generated OpenAPI Specification that is not enough typed (the object should be an explicit object like "OrderCollection"
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Order"
}
},
"nextLink": {
"type": "string"
}
}
}
}
}
}
Version
1.6.77
What database are you using?
Azure SQL
What hosting model are you using?
Custom Docker host
Which API approach are you accessing DAB through?
REST
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
- Lenguaje dominante
- C#
- Estrellas
- 1.5k
- Forks
- 372
- Merge medio
- 9 d 1 h
- PR fusionados (30 d)
- 13
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.
Más de Azure/data-api-builder
-
pgsql
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3598 ·
-
2.x cli mcp-server
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3576 ·
-
2.x health-endpoint
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3570 ·
-
2.x telemetry
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/data-api-builder#3564 ·
-
2.x telemetry
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Azure/data-api-builder#3562 ·
Todos los issues de Azure/data-api-builder
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
bug needs response
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Adyen/adyen-dotnet-api-library#1869 ·
-
Status: Needs Triage Type: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
bug effort:S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
nightscout/nocturne#1602 ·