api - How to reuse header definitions in RAML 1.0 -
i have raml 1.0 specification define multiple resources. each of resources have same set of headers.
what constructs of raml need use declare headers once , reuse them in various resource definitions?
for e.g.
/read/records: post: description: api reading records queryparameters: table_name: string headers: authorization: displayname: authorization description: basic authentication base 64 encoded string type: string required: true tenant-id: displayname: tenant-id description: tenant id multi-tenant environments type: string required: true content-type: displayname: content-type description: either xml or json type: string required: true /adjust/records: post: description: api editing records headers: authorization: displayname: authorization description: basic authentication base 64 encoded string type: string required: true tenant-id: displayname: tenant-id description: tenant id multi-tenant environments type: string required: true content-type: displayname: content-type description: either xml or json type: string required: true
thanks!
you can use traits that:
#%raml 1.0 traits: hasheaders: headers: authorization: displayname: authorization description: basic authentication base 64 encoded string type: string required: true tenant-id: displayname: tenant-id description: tenant id multi-tenant environments type: string required: true content-type: displayname: content-type description: either xml or json type: string required: true /read/records: post: is: ["hasheaders"] description: api reading records queryparameters: table_name: string /adjust/records: post: is: ["hasheaders"] description: api editing records
Comments
Post a Comment