Skip to content

Add parameter/attribute defaults, enums and annotations for API Blueprint #422

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

Merged

Conversation

Erol
Copy link
Contributor

@Erol Erol commented Dec 6, 2018

This will include the default and enum metadata when rendering parameters or attributes.

The following parameter declaration:

parameter :status, 'Status', type: :string, default: 'completed', enum: %w[pending complete]

Would be rendered as:

+ Parameters
  + status (optional, string) - Status
      + Default: `complete`
      + Members
          + `pending`
          + `complete`

I've also added the ability to add raw API Blueprint annotations for object attributes, which is useful when describing JSONAPI payloads:

attribute :data, type: :object, required: true, annotation: <<~MARKDOWN
    + attributes (required, object)
        + name (required, string)
MARKDOWN

This will be rendered to:

+ Attributes (object)
  + data (required, object) - 
      + attributes (required, object)
          + name (required, string)

@Erol Erol changed the title Add parameter defaults and enums to API Blueprint Add parameter/attribute defaults, enums and annotations for API Blueprint Dec 6, 2018
@Erol
Copy link
Contributor Author

Erol commented Dec 11, 2018

Do you have some feedback for this @oestrich?

@alebian
Copy link

alebian commented Dec 26, 2018

I am having the same problem with minimum and maximum attributes, can we fix that too in this PR?

@Erol
Copy link
Contributor Author

Erol commented Dec 26, 2018

I'd like to get the heads up from a contributor first if this PR is worth merging. I can open a new one after

@Erol
Copy link
Contributor Author

Erol commented Feb 22, 2019

Hi @oestrich, can I get a feedback for this PR?

@oestrich
Copy link
Contributor

Hey @Erol it looks good, can you just add a few tests around it? I can merge it after that.

@Erol
Copy link
Contributor Author

Erol commented Feb 26, 2019

Sure @oestrich, I'll give you the heads up once the tests are done

@Erol Erol force-pushed the add-parameter-defaults-and-enums-to-api-blueprint branch from d10b2ed to fa1c79a Compare March 14, 2019 01:13
@Erol
Copy link
Contributor Author

Erol commented Mar 14, 2019

Hi @oestrich, I've updated the PR with tests

@oestrich oestrich merged commit 1dcc7f8 into zipmark:master Mar 14, 2019
@oestrich
Copy link
Contributor

Thanks!

@Erol Erol deleted the add-parameter-defaults-and-enums-to-api-blueprint branch March 14, 2019 01:32
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

Successfully merging this pull request may close these issues.

3 participants