Module: JekyllOpenAPI::Filters
- Defined in:
- lib/jekyll_openapi/filters.rb
Overview
Liquid filters over the JekyllOpenAPI model and renderers.
This module has no dependency on the liquid gem itself: it is a plain module of filter methods. Consumers opt in with:
Liquid::Template.register_filter(JekyllOpenAPI::Filters)
or register only a subset by wrapping the methods they want.
Instance Method Summary collapse
-
#oapi_dereference(input) ⇒ Object
Resolve every local $ref in an OpenAPI document (circular-safe).
-
#oapi_merge_parameters(path_params, operation_params) ⇒ Object
Merge path-level and operation-level parameter lists (operation wins).
-
#oapi_operations(input, tag = nil) ⇒ Object
Flat operation list from a full document, optionally filtered by tag.
-
#oapi_parameters(input) ⇒ Object
Group a parameter list by location: => [...], "path" => [...], ....
-
#oapi_schema(input) ⇒ Object
Render a JSON-Schema as a TypeScript-like string.
-
#oapi_tags(input) ⇒ Object
Tag list of a full document.
-
#oapi_xml_schema(input) ⇒ Object
Render a JSON-Schema as a simplified XML example.
Instance Method Details
#oapi_dereference(input) ⇒ Object
Resolve every local $ref in an OpenAPI document (circular-safe)
13 14 15 |
# File 'lib/jekyll_openapi/filters.rb', line 13 def oapi_dereference(input) Dereferencer.new(input).dereference end |
#oapi_merge_parameters(path_params, operation_params) ⇒ Object
Merge path-level and operation-level parameter lists (operation wins)
23 24 25 |
# File 'lib/jekyll_openapi/filters.rb', line 23 def oapi_merge_parameters(path_params, operation_params) Parameters.merge(path_params, operation_params) end |
#oapi_operations(input, tag = nil) ⇒ Object
Flat operation list from a full document, optionally filtered by tag. See Document#operations for the shape of each entry.
29 30 31 |
# File 'lib/jekyll_openapi/filters.rb', line 29 def oapi_operations(input, tag = nil) document(input).operations(tag: tag) end |
#oapi_parameters(input) ⇒ Object
Group a parameter list by location: => [...], "path" => [...], ...
18 19 20 |
# File 'lib/jekyll_openapi/filters.rb', line 18 def oapi_parameters(input) Parameters.group(input) end |
#oapi_schema(input) ⇒ Object
Render a JSON-Schema as a TypeScript-like string
39 40 41 |
# File 'lib/jekyll_openapi/filters.rb', line 39 def oapi_schema(input) SchemaRenderer::TypeScript.render(input) end |
#oapi_tags(input) ⇒ Object
Tag list of a full document
34 35 36 |
# File 'lib/jekyll_openapi/filters.rb', line 34 def (input) document(input). end |
#oapi_xml_schema(input) ⇒ Object
Render a JSON-Schema as a simplified XML example
44 45 46 |
# File 'lib/jekyll_openapi/filters.rb', line 44 def oapi_xml_schema(input) SchemaRenderer::XML.render(input) end |