Skip to main content

Module util

Module util 

Source
Expand description

Assorted function that are used throughout the application.

Functions§

add_content_response
Adds a Response to a Responses object with the given status code, Content-Type and MediaType.
add_default_response_code
Add default response, for when status code is defined at runtime. https://spec.openapis.org/oas/v3.0.0#fixed-fields-13
add_default_response_schema
Add default response with a Schema, for when status code is defined at runtime. https://spec.openapis.org/oas/v3.0.0#fixed-fields-13
add_media_type
Adds the media to the given map. If the map already contains a MediaType with the given Content-Type, then it will be combined with media.
add_schema_response
Adds a Response to a Responses object with the given status code, Content-Type and SchemaObject.
change_all_responses_to_default
Change all responses in the map to “default” response code. In case of doubles the first items will be reserved.
ensure_status_code_exists
Checks if the provided status code is in the responses.responses field. If it isn’t, inserts it.
produce_any_responses
Merges the the two given Responses.
set_content_type
Replaces the Content-Type for all responses with content_type.
set_status_code
Takes a Responses struct, and sets the status code to the status code provided for each response in the Responses.