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 @@ -468,13 +468,38 @@ const SampleSchema = t.type({
468468
469469These are some tags that you can use in your schema JSDocs are custom to this generator.
470470
471+ - ` @contentType ` allows you to override the default ` application/json ` content type for
472+ requests and responses. Can be applied at route level (affects both request and
473+ response), request body level, or individual response status code level.
471474- ` @private ` allows you to mark any field as in any schema as private. The final spec
472475 will have ` x-internal: true ` for schemas with the ` @private ` tag.
473476- ` @deprecated ` allows to mark any field in any schema as deprecated. The final spec
474477 will include ` deprecated: true ` in the final specificaiton.
475478
476479``` typescript
477480import * as t from ' io-ts' ;
481+ import * as h from ' @api-ts/io-ts-http' ;
482+
483+ /**
484+ * Route-level content type
485+ * @contentType multipart/form-data
486+ */
487+ export const uploadRoute = h .httpRoute ({
488+ request: h .httpRequest ({
489+ /**
490+ * Request-specific content type
491+ * @contentType application/xml
492+ */
493+ body: t .type ({ data: t .string }),
494+ }),
495+ response: {
496+ /**
497+ * Response-specific content type
498+ * @contentType text/plain
499+ */
500+ 200 : t .string ,
501+ },
502+ });
478503
479504const Schema = t .type ({
480505 /** @private */
You can’t perform that action at this time.
0 commit comments