acacode / acacode/swagger-typescript-api

Invalid doc block on --responses --extract-response-error

Ouverte
#665 0 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
4.1k
Forks
436
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I found a little bug today. When generating a client with `--responses --extract-response-error`, I get a doc block that does not look as I expect.

I would like it to use my error object instead of an anonymous definition.

Full generate command:

```
swagger-typescript-api -p ./swagger-api.json -o ./src/MyApi -n myApi.ts --axios --sort-types --sort-routes --extract-enums --add-readonly --route-types --extract-request-params --extract-request-body --extract-response-body --extract-response-error --responses --modular --unwrap-response-data
```

Here are the changes I would like to see in the generated output.
```diff
/**
* A good description
*
* @tags Brand
* @name PostUpdateLogoInvoke
* @request POST:/brands/{brandId}/logo
* @response `200` `PostUpdateLogoInvokeData` Returns a brand
+ * @response `400` `PostUpdateLogoInvokeError` Bad request
- * @response `400` `{
- errors?: ({
- \** An application-specific error code *\
- code?: string,
- \** A human-readable explanation specific to this occurrence of the problem *\
- detail?: string,
- source?: {
- message?: string,
- parameter?: string,
-},
- \** The HTTP status code applicable to this problem *\
- status?: string,
- \** A short, human-readable summary of the problem *\
- title?: string,
-
-})[],
-
-}` Bad request
*/
postUpdateLogoInvoke = ({ brandId, ...query }: PostUpdateLogoInvokeParams, data: any, params: RequestParams = {}) =>
this.request({
path: `/brands/${brandId}/logo`,
method: 'POST',
query: query,
body: data,
type: ContentType.FormData,
...params,
});
```

The `PostUpdateLogoInvokeError` is generated correctly.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.