Skip to content

Document OpenAPI 3.x support - #1006

Open
numbata wants to merge 1 commit into
pr/7-validation-and-parityfrom
pr/8-docs
Open

numbata wants to merge 1 commit into
pr/7-validation-and-parityfrom
pr/8-docs

Conversation

@numbata

@numbata numbata commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Users learn that grape-swagger can emit OpenAPI 3.0 and 3.1, how to turn it on, and how the output differs from Swagger 2.0. The README and a dedicated guide describe the new option, and the guide lists where the output differs from Swagger 2.0. It also advises setting an explicit host: in production.

Problem solved

A feature nobody can find or understand does not help users, and the Swagger 2.0 behavior changes in this stack need to be announced where people look for them.

What changes

A README section and a guide cover the option, how settings map to OpenAPI 3, security schemes, nullable handling and 3.1 features. Each layer adds its own single changelog line; this one adds the line for the docs.

Drawbacks and nuances

  • Documentation must be kept in step with the builder as it evolves.
  • With host unset the OpenAPI 3 servers URL follows the request Host, which the README now tells users to avoid in production.
  • Known gaps (tsv collection format, default style, duplicated hash and array-of-object container parameters on GET (the array container typed as an array of strings), tag collection, braces on nested array query and form fields) are listed in the guide rather than fixed.

Alternatives considered

  • Put the guide only in the README: the README is already long, so detail sits in its own file.
  • Write docs alongside each code step: smaller diffs, but readers of the intermediate steps get a half-finished story.

Stacks on: pr/7-validation-and-parity.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Danger Report

Errors

  • The TOC found in README.md doesn't match the sections of the file.

Markdowns

Here's the expected TOC for README.md:

# Table of Contents

- [What is grape-swagger? ](#what-is-grape-swagger-)
- [Related Projects ](#related-projects-)
- [Compatibility ](#compatibility-)
- [Swagger-Spec ](#swagger-spec-)
- [Installation ](#installation-)
- [Upgrade](#upgrade)
- [Usage ](#usage-)
- [Model Parsers ](#model-parsers-)
  - [Custom Model Parsers](#custom-model-parsers)
    - [insert_before](#insert_before)
    - [insert_after](#insert_after)
  - [CORS](#cors)
- [Configure ](#configure-)
    - [openapi_version: ](#openapi_version-)
    - [json_schema_dialect: ](#json_schema_dialect-)
    - [webhooks: ](#webhooks-)
    - [host: ](#host-)
    - [base_path: ](#base_path-)
    - [mount_path: ](#mount_path-)
    - [add_base_path: ](#add_base_path-)
    - [add_root: ](#add_root-)
    - [add_version: ](#add_version-)
    - [doc_version: ](#doc_version-)
    - [endpoint_auth_wrapper: ](#endpoint_auth_wrapper-)
    - [swagger_endpoint_guard: ](#swagger_endpoint_guard-)
    - [token_owner: ](#token_owner-)
    - [security_definitions: ](#security_definitions-)
    - [security: ](#security-)
    - [models: ](#models-)
    - [tags: ](#tags-)
    - [hide_documentation_path: (default: true) ](#hide_documentation_path-default-true-)
    - [info: ](#info-)
    - [array_use_braces: ](#array_use_braces-)
    - [api_documentation](#api_documentation)
    - [specific_api_documentation](#specific_api_documentation)
    - [consumes](#consumes)
    - [produces](#produces)
- [Routes Configuration ](#routes-configuration-)
    - [Swagger Header Parameters  ](#swagger-header-parameters--)
    - [Hiding an Endpoint ](#hiding-an-endpoint-)
    - [Overriding Auto-Generated Nicknames ](#overriding-auto-generated-nicknames-)
    - [Specify endpoint details ](#specify-endpoint-details-)
    - [Overriding the route summary ](#overriding-the-route-summary-)
    - [Overriding the tags ](#overriding-the-tags-)
    - [Deprecating routes ](#deprecating-routes-)
    - [Overriding the name of the body parameter ](#overriding-the-name-of-the-body-parameter-)
    - [Defining an endpoint as an array ](#defining-an-endpoint-as-an-array-)
    - [Using an options hash ](#using-an-options-hash-)
    - [Overriding parameter type ](#overriding-parameter-type-)
    - [Overriding data type of the parameter ](#overriding-data-type-of-the-parameter-)
    - [Multiple types ](#multiple-types-)
    - [Array of data type ](#array-of-data-type-)
    - [Collection format of arrays ](#collection-format-of-arrays-)
    - [Hiding parameters ](#hiding-parameters-)
    - [Setting a Swagger default value ](#setting-a-swagger-default-value-)
  - [Setting additionalProperties for object-type parameters ](#setting-additionalproperties-for-object-type-parameters-)
    - [Allow any additional properties](#allow-any-additional-properties)
    - [Allow any additional properties of a particular type](#allow-any-additional-properties-of-a-particular-type)
    - [Allow any additional properties matching a defined schema](#allow-any-additional-properties-matching-a-defined-schema)
    - [Example parameter value ](#example-parameter-value-)
    - [Expose nested namespace as standalone route](#expose-nested-namespace-as-standalone-route)
      - [With a custom name](#with-a-custom-name)
    - [Response documentation ](#response-documentation-)
    - [Changing default status codes ](#changing-default-status-codes-)
    - [Multiple status codes for response ](#multiple-status-codes-for-response-)
    - [File response ](#file-response-)
    - [Default response ](#default-response-)
    - [Extensions ](#extensions-)
    - [Response examples documentation ](#response-examples-documentation-)
    - [Response headers documentation ](#response-headers-documentation-)
    - [Adding root element to responses ](#adding-root-element-to-responses-)
    - [Multiple present Response ](#multiple-present-response-)
- [Using Grape Entities ](#using-grape-entities-)
  - [Documented class/definition](#documented-classdefinition)
  - [Custom Model Description and Example](#custom-model-description-and-example)
  - [Relationships](#relationships)
    - [1xN](#1xn)
    - [1x1](#1x1)
    - [Inheritance with allOf and discriminator](#inheritance-with-allof-and-discriminator)
- [Securing the Swagger UI ](#securing-the-swagger-ui-)
- [Example ](#example-)
    - [Grouping the API list using Namespace](#grouping-the-api-list-using-namespace)
    - [Example Code](#example-code)
- [Rake Tasks ](#rake-tasks-)
    - [OpenApi/Swagger Documentation](#openapiswagger-documentation)
    - [OpenApi/Swagger Validation](#openapiswagger-validation)
- [Contributing to grape-swagger](#contributing-to-grape-swagger)
- [Copyright and License](#copyright-and-license)

View run

Users need to know that the `openapi_version` option exists, what it
changes in the output, and where OpenAPI 3 differs from Swagger 2.0. This
adds a README section and a dedicated guide covering option mapping,
security schemes, nullable handling, 3.1 features and the known
differences and limitations.

The README also advises setting an explicit `host:` in production, since
the OpenAPI 3 `servers` URL otherwise follows the Host header of the
request that fetches the documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant