Skip to content

Commit

Permalink
add some examples for summary and tags to README
Browse files Browse the repository at this point in the history
  • Loading branch information
mercedesb committed Dec 1, 2023
1 parent d0cece7 commit 08f0c2a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,12 @@ EOS
RSpec::OpenAPI.description_builder = -> (example) { example.description }

# Generate a custom summary, given an RSpec example
RSpec::OpenAPI.summary_builder = -> (example) { example.metadata[:summary] }
# This example uses the summary from the example_group.
RSpec::OpenAPI.summary_builder = ->(example) { example.metadata.dig(:example_group, :openapi, :summary) }

# Generate a custom tags, given an RSpec example
RSpec::OpenAPI.tags_builder = -> (example) { example.metadata[:tags] }
# This example uses the tags from the parent_example_group
RSpec::OpenAPI.tags_builder = -> (example) { example.metadata.dig(:example_group, :parent_example_group, :openapi, :tags) }

# Change the example type(s) that will generate schema
RSpec::OpenAPI.example_types = %i[request]
Expand Down

0 comments on commit 08f0c2a

Please sign in to comment.