Skip to content

Commit b395595

Browse files
committed
Pass extension documentation into schema
1 parent f001b87 commit b395595

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

lib/grape-swagger/entity/attribute_parser.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def call(entity_options)
1919
entity_model_type = entity_model_type(name, entity_options)
2020
return entity_model_type unless documentation
2121

22+
add_extension_documentation(entity_model_type, documentation)
2223
add_array_documentation(entity_model_type, documentation) if documentation[:is_array]
2324

2425
entity_model_type

spec/grape-swagger/entities/response_model_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def app
6060
'kind3' => { '$ref' => '#/definitions/ThisApi_Entities_Kind', 'description' => 'Tertiary kind.' },
6161
'tags' => { 'type' => 'array', 'items' => { '$ref' => '#/definitions/ThisApi_Entities_Tag' },
6262
'description' => 'Tags.' },
63-
'relation' => { '$ref' => '#/definitions/ThisApi_Entities_Relation', 'description' => 'A related model.' },
63+
'relation' => { '$ref' => '#/definitions/ThisApi_Entities_Relation', 'description' => 'A related model.',
64+
'x-other' => 'stuff' },
6465
'code' => { 'type' => 'string', 'description' => 'Error code' },
6566
'message' => { 'type' => 'string', 'description' => 'Error message' },
6667
'attr' => { 'type' => 'string', 'description' => 'Attribute' } },

spec/support/shared_contexts/this_api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Something < Grape::Entity
3636
expose :kind3, using: ThisApi::Entities::Kind, documentation: { desc: 'Tertiary kind.' }
3737
expose :tags, using: ThisApi::Entities::Tag, documentation: { desc: 'Tags.', is_array: true }
3838
expose :relation, using: ThisApi::Entities::Relation,
39-
documentation: { type: 'ThisApi::Relation', desc: 'A related model.' }
39+
documentation: { type: 'ThisApi::Relation', desc: 'A related model.', x: { other: 'stuff' } }
4040
expose :merged_attribute, using: ThisApi::Entities::Nested, merge: true
4141
end
4242
end

0 commit comments

Comments
 (0)