![]() ![]() Rather than placing all the types, resource types or traits in their own respective include files, you can also use special types of includes known as typed fragments to break each of these constructs into multiple include files, specifying a different file for each type, resource type or trait. ResourceTypes: !include allResourceTypes.raml Here is an example showing all three uses of the !include tag: #%RAML 1.0 The logical corollary to the latter is that an included file may itself contain other !include directives. This location may be an absolute URL, a path relative to the root RAML file, or a path relative to the including file.Ī location starting with a forward slash (/) indicates a path relative to the location of the root RAML file, and a location beginning without a slash is interpreted to be relative to the location of the including file. The !include tag takes a single argument: the location of the external file containing the property value. Our first article touched briefly on the use of includes when we were specifying data types and examples whose properties were being repeated inline throughout the API. The purpose of an include is to modularize a complex property value in a RAML definition by placing the property value in an external file. Here are the resources making up our API: Our APIįor the purpose of this article, we shall focus on the portion of our API involving the entity type called Foo. In this article, we show how you can break your RAML API definition into modules by making use of includes, libraries, overlays, and extensions. In our first two articles on RAML – the RESTful API Modeling Language – we introduced some basic syntax, including the use of data types and JSON schema, and we showed how to simplify a RAML definition by extracting common patterns into resource types and traits.
0 Comments
Leave a Reply. |