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

Reuse headers and attributes? #259

Closed
winniehell opened this issue Aug 27, 2015 · 9 comments
Closed

Reuse headers and attributes? #259

winniehell opened this issue Aug 27, 2015 · 9 comments

Comments

@winniehell
Copy link

I have a model which defines headers and a model which defines attributes:

## Fast [/fast]

+ Model
    + Headers

            X-Fast-Processing: true

## Things [/things]

+ Attributes (object)
    + name (string)

Now I want to use the headers in GET- and PUT-request and the attributes in GET-response and PUT-request. The following does not work:

### Get Things [GET]

+ Request
    [Fast ][]

+ Response 200 (application/json)
    + Attributes (Things)

### Put Things [PUT]

+ Request (application/json)
    [Fast ][]
    + Attributes (Things)

+ Response 200

            Everything fine.

Is there any way to achieve this?

@winniehell
Copy link
Author

Putting the headers from Fast into the Things model does not work because I need to reuse the Fast-headers in other resources, too.

@pksunkara
Copy link
Contributor

@winniehell The Model you are defining is a payload. Request and Response are payloads too. So, you can use the following the syntax to reference the payload

+ Request
    [Fast][]

But you can not combine it with other parts in a payload.

PS: Currently, you cannot reuse headers.

@pksunkara
Copy link
Contributor

This might be a duplicate of #17 but I will leave it to @zdne.

@winniehell
Copy link
Author

@pksunkara: yep, looks duplicate to me - I don't know why I didn't find that issue. Thank you for the hint! 👍

@pksunkara pksunkara reopened this Aug 27, 2015
@pksunkara
Copy link
Contributor

I would like to keep this issue open and let @zdne decide since #17 is linked to Traits.

@winniehell
Copy link
Author

Sure, I don't mind. 🐠

My primary intention was to find out how to reuse headers and attributes. That problem seems so be solved by Traits as far as I understand it:

## Fast [/fast]

+ Trait Fast
    + Request Headers

            X-Fast-Processing: true

## Things [/things]

+ Trait Thing
    + Properties
        + name (string)

### Get Things [GET]

+ Request
    + Traits
        + [Fast][]

+ Response 200 (application/json)
    + Traits
        + [Things][]

### Put Things [PUT]

+ Request (application/json)
    + Traits
        + [Fast][]
        + [Things][]

+ Response 200

            Everything fine.

Or do I get something wrong?

@pksunkara
Copy link
Contributor

@winniehell Well, the traits was still in proposal stage and is currently in an uncertain state since we now have MSON. So, please keep a look out on further updates.

@zdne
Copy link
Contributor

zdne commented Aug 28, 2015

@winniehell @pksunkara I plan to update and close the traits issue during the course of the next week. To the original question, reusable headers using MSON syntax are definitely planned.

@zdne
Copy link
Contributor

zdne commented Sep 28, 2015

RFC proposal of syntax addressing this issue: apiaryio/api-blueprint-rfcs#3.

Please track and comment on the RFC.

Thank you!

@zdne zdne closed this as completed Sep 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants