Answer the question
In order to leave comments, you need to log in
How in RAML to remove some parameters from the type that is used for the request body?
Hello.
I use RAML 1.0
There is a type Order
with some fields, including id.
There is a POST request to /orders, in the body of which the "Order" object is passed, but without the id field.
Is there any way to exclude this field from the list of type fields for the request body?
that is, this type is specified both as the type for the request body and as the type of the response structure. You don’t want to use 2 different types, or you don’t want an inline description, since the Order type has all fields with descriptions and this will be a duplication of 80% of the information. You can also create an OrderRequest type and inherit it in Orders, but this is also some kind of crutch ...
Is there any solution?
Answer the question
In order to leave comments, you need to log in
create an OrderRequest type and inherit it in Orders, but this is also some kind of crutch ...
RAML 1.0 supports inheritance from several types:
#%RAML 1.0
title: Example API
version: v1
types:
Order:
type: object
properties:
id:
type: integer
date:
type: integer
Ext_type:
type: object
properties:
ext_type_property:
type: string
Order_ext:
type: [Order,Ext_type]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question