Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to reuse responses #467

Open
goganchic opened this issue Apr 30, 2017 · 0 comments
Open

Ability to reuse responses #467

goganchic opened this issue Apr 30, 2017 · 0 comments

Comments

@goganchic
Copy link
Contributor

In our project we have very big api documentation. A lot of actions have identical responses like:

+ Response 401 (appliction/json)
    + Attributes
        + status: Unauthorized (required, fixed)

It's inconvenient to add such responses to almost every action. If we adds/modify/remove some common responses we have to process all actions. Chance to forget or misspell something is huge. So it will be very useful to have an ability to write common responses only once and drafter should do all required magic. Here is example:

# Group Authorized resources

# Common Data
+ Response 401 (application/json)
    + Attributes
        + status: Unauthorized (required, fixed)

## Posts [GET /posts]
+ Response 200 (application/json)
    + Attributes
        + result (array) - list of posts

## Comments [GET /comments]
+ Response 200 (application/json)
    + Attributes
        + result (array) - list of comments

In this case response 401 should be added to GET /posts and GET /comments actions. If I need to modify it - I'll do it only once in one place.

If I need to add some common data to one group only I can do it like this:

# Group Authorized resources

# Common Data
+ Response 401 (application/json)
    + Attributes
        + status: Unauthorized (required, fixed)

## Posts [GET /posts]
+ Response 200 (application/json)
    + Attributes
        + result (array) - list of posts

## Comments [GET /comments]
+ Response 200 (application/json)
    + Attributes
        + result (array) - list of comments

# Group Authentication

## Login [POST /login]
In this section 401 response will not be added, because it was defined in another group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@goganchic and others