File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
packages/openapi-generator Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -472,9 +472,13 @@ These are some tags that you can use in your schema JSDocs are custom to this ge
472472 will have ` x-internal: true ` for schemas with the ` @private ` tag.
473473- ` @deprecated ` allows to mark any field in any schema as deprecated. The final spec
474474 will include ` deprecated: true ` in the final specificaiton.
475+ - ` @contentType ` allows you to override the default ` application/json ` content type for
476+ requests and responses. Can be applied at route level (affects both request and
477+ response), request body level, or individual response status code level.
475478
476479``` typescript
477480import * as t from ' io-ts' ;
481+ import * as h from ' @api-ts/io-ts-http' ;
478482
479483const Schema = t .type ({
480484 /** @private */
@@ -483,4 +487,25 @@ const Schema = t.type({
483487 deprecatedField: t .string ,
484488 publicNonDeprecatedField: t .string ,
485489});
490+
491+ /**
492+ * Route-level content type
493+ * @contentType multipart/form-data
494+ */
495+ export const uploadRoute = h .httpRoute ({
496+ request: h .httpRequest ({
497+ /**
498+ * Request-specific content type
499+ * @contentType application/xml
500+ */
501+ body: t .type ({ data: t .string }),
502+ }),
503+ response: {
504+ /**
505+ * Response-specific content type
506+ * @contentType text/plain
507+ */
508+ 200 : t .string ,
509+ },
510+ });
486511```
You can’t perform that action at this time.
0 commit comments