Skip to content

feat(openapi): support serialization of path parameters - #957

Open
abhi-byte62 wants to merge 1 commit into
fastify:mainfrom
abhi-byte62:contrib/path-param-serialization
Open

abhi-byte62 wants to merge 1 commit into
fastify:mainfrom
abhi-byte62:contrib/path-param-serialization

Conversation

@abhi-byte62

Copy link
Copy Markdown

Problem

OpenAPI 3.0/3.1 specifies serialization rules (\style\ and \explode) for path parameters in addition to query, header, and cookie parameters (e.g. \matrix, \label, and \simple\ styles). In \lib/spec/openapi/utils.js, \plainJsonObjectToOpenapi3()\ supported \style\ and \explode\ for query/header/cookie parameters, but the \path\ container case omitted them when building the parameter object.

Fix

Add \style\ and \explode\ propagation in \ oOpenapiProp\ for the \path\ container in \lib/spec/openapi/utils.js, matching the serialization behavior of query parameters. Also update README documentation to reference path parameter serialization support.

Tests


  • pm test\ — passed (all 299 tests pass, TypeScript typings pass, 100% test coverage maintained).

  • pm run lint\ — passed (eslint clean, 0 errors/warnings).
  • Added unit test \support path serialization params\ in \ est/spec/openapi/schema.test.js.

Related issue

Fixes #912

Checklist

  • run
    pm run test\
  • tests are included
  • documentation is changed or added
  • commit message and code follows the Developer's Certificate of Origin and the Code of Conduct

Adds support for OpenAPI 3 path parameter serialization options (style and explode), matching query/header/cookie parameters in plainJsonObjectToOpenapi3.

Fixes fastify#912
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.

Support for serialization of path parameters

1 participant