Skip to content

Commit fa1c79a

Browse files
committed
Add specs
1 parent d6ce378 commit fa1c79a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

features/api_blueprint_documentation.feature

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ Feature: Generate API Blueprint documentation from test examples
115115
attribute :name, 'The order name', required: true, :example => 'a name'
116116
attribute :amount, required: false
117117
attribute :description, 'The order description', type: 'string', required: false, example: "a description"
118+
attribute :category, 'The order category', type: 'string', required: false, default: 'normal', enum: %w[normal priority]
119+
attribute :metadata, 'The order metadata', type: 'json', required: false, annotation: <<-MARKDOWN
120+
+ instructions (optional, string)
121+
+ notes (optional, string)
122+
MARKDOWN
118123
119124
get 'Returns a single order' do
120125
explanation "This is used to return orders."
@@ -360,6 +365,14 @@ Feature: Generate API Blueprint documentation from test examples
360365
+ name: a name (required) - The order name
361366
+ amount (optional)
362367
+ description: a description (optional, string) - The order description
368+
+ category (optional, string) - The order category
369+
+ Default: `normal`
370+
+ Members
371+
+ `normal`
372+
+ `priority`
373+
+ metadata (optional, json) - The order metadata
374+
+ instructions (optional, string)
375+
+ notes (optional, string)
363376
364377
### Deletes a specific order [DELETE]
365378

templates/rspec_api_documentation/api_blueprint_index.mustache

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,25 @@ explanation: {{ explanation }}
3636
+ `{{.}}`
3737
{{/ enum}}
3838
{{/ has_enum?}}
39+
{{# annotations }}
40+
{{ . }}
41+
{{/ annotations }}
3942
{{/ parameters }}
4043
{{/ has_parameters? }}
4144
{{# has_attributes? }}
4245

4346
+ Attributes (object)
4447
{{# attributes }}
4548
+ {{ name }}{{# example }}: {{ example }}{{/ example }}{{# properties_description }} ({{ properties_description }}){{/ properties_description }}{{# description }} - {{ description }}{{/ description }}
49+
{{# has_default?}}
50+
+ Default: `{{default}}`
51+
{{/ has_default?}}
52+
{{# has_enum?}}
53+
+ Members
54+
{{# enum}}
55+
+ `{{.}}`
56+
{{/ enum}}
57+
{{/ has_enum?}}
4658
{{# annotations }}
4759
{{ . }}
4860
{{/ annotations }}

0 commit comments

Comments
 (0)