Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions annotations/methods/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Method annotations

## `tags`

### Purpose

> This annotation is an equivalent of the `tags` property of the OpenAPI OAS 3.0 Specification. Note
that it works slighly differently than its OAS counterpart. It has been simplified and tags are
defined and accessed globally whether at the root of the document or on a method.

(see full [description](tags.raml))

### What's included?

This directory contains the following RAML fragments:
- tags.raml (AnnotationTypeDeclaration)
- tags-lib.raml (Library)

and the following example:
- tags-example.raml

### Which tools support this

- [mulesoft/api-console (v5.0.x)](https://github.com/mulesoft/api-console)
24 changes: 24 additions & 0 deletions annotations/methods/tags-example.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#%RAML 1.0
title: API with tags

annotationTypes:
tags: !include tags.raml

(tags):
- name: users
description: This tag denotes a "User"-related method

/users:
get:
(tags): [users]

/{id}:
get:
(tags): [users]

/me:
get:
(tags):
- users
- name: alias
description: This is an alias
7 changes: 7 additions & 0 deletions annotations/methods/tags-lib.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#%RAML 1.0 Library

types:
tagObject:
properties:
name: string
description?: string
59 changes: 59 additions & 0 deletions annotations/methods/tags.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#%RAML 1.0 AnnotationTypeDeclaration

uses:
lib: tags-lib.raml

displayName: Tags Object
description: |
This annotation is an equivalent of the `tags` property of the OpenAPI OAS 3.0 Specification. Note
that it works slighly differently than its OAS counterpart. It has been simplified and tags are
defined and accessed globally whether at the root of the document or on a method.

It can either be an array of references to an existing tag, e.g.

```yaml
#%RAML 1.0
title: my example API

annotationTypes:
tags: !include tags.raml

(tags):
- name: bar
description: This is a "bar" tagged resource

/foo:
get:
(tags):
- bar
- qux:
name: qux
description: This is a "qux" tagged resource

/users:
post:
(tags): [bar, qux]
```

or an inline tag definition that can later be referenced:

```yaml
#%RAML 1.0
title: my example API

annotationTypes:
tags: !include tags.raml

/foo:
get:
(tags):
- name: bar
description: This is a "bar" tagged resource

/users:
post:
(tags): [bar]
```
type: array
items: string | lib.tagObject
allowedTargets: [API, Method]