loopbackio / loopbackio/loopback-connector-openapi
OAS 3.0.1 Dictionaries are parsed incorrectly
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 8
- Forks
- 4
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Steps to reproduce
Define a OAS with the following definition endpoint definition:
"/price/getprice": {
"get": {
"tags": [
"price-controller"
],
"summary": "Get the price of data",
"operationId": "getPrice",
"parameters": [
{
"name": "parameters",
"in": "query",
"description": "characteristic parameters of the data",
"required": true,
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
],
"responses": {
"200": {
"description": "price of data",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
Current Behavior
It generates the following service
export interface PriceControllerService {
getPrice(parameters: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[additionalProperty: string]: any;
}): Promise<string>;
}
This result is wrong! Based on the documentation https://swagger.io/docs/specification/data-models/dictionaries/ it should pass all the query attributes directly, instead of trying nest them under parameters: {}.
So when calling the endpoint -> /price/getprice?a=1&b=2 it throws the error MISSING_REQUIRED_PARAMETERS
{
"error": {
"statusCode": 400,
"name": "BadRequestError",
"message": "Required parameter parameters is missing!",
"code": "MISSING_REQUIRED_PARAMETER"
}
}
Expected Behavior
It should support Maps and Dictionaries and somehow allow dynamic parameters throught the query. Is there any solution implemented? Thanks!
Link to reproduction sandbox
Additional information
Related Issues
See Reporting Issues for more tips on writing good issues
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Keine Quelldatei oder kein Test ist angegeben. Beginne damit, die Definition von OAS 3.0.1 im OpenAPI-Connector zu reproduzieren, und verfolge, wie der Dictionary-Abfrageparameter zur generierten TypeScript-Service-Signatur wird; fertig ist es, wenn Abfrageattribute wie a=1 und b=2 direkt akzeptiert werden, ohne dass ein Fehler wegen fehlender Parameter auftritt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, openapi, typescript
- Bereich
- api, backend
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100