[go: up one dir, main page]

Skip to content

Build OpenAPI path and operation handling

Overview

Implement models and converters for paths and operations, which form the core of the API specification. This handles the transformation of Grape routes and endpoints into OpenAPI path items and operations.

Within OpenAPI specifications, a path can have multiple operations. An example of a path is /users/:id and an operation is get, or patch to either get, or update a user. An operation is made up of a path, and a method.

  • PathItem model represents all operations for a given path
  • Operation model represents individual HTTP operations (GET, POST, etc.)
  • PathConverter extracts and groups Grape routes by path
  • OperationConverter transforms Grape endpoints to Operation models
  • Path parameters are properly extracted (e.g., /users/{id})
  • Operation descriptions from desc blocks are captured
  • Operation IDs are generated
  • Tags are properly assigned to operations
Edited by Chance Feick