Skip to content

Bug: Issues Generating API Client from Dynamic .json-Included Paths with openapi2aspida #254

@KiichiSugihara

Description

@KiichiSugihara

Description

When using path names that include .json in the OpenAPI definition, attempting to generate an API client with openapi2aspida results in a file name pattern matching error. This issue specifically occurs with parameterized paths (e.g., /category/{id}.json), not with static paths (for example, /new.json). Removing .json from the path resolves the issue, enabling successful API client generation

Environment

  • Package version:
    v0.23.2
  • OS:
    • Linux
    • Windows
    • macOS
  • Node.js version: v20.9.0
  • npm version: 10.1.0

Additional context

Specifying a path that includes .json in the OpenAPI definition leads to the following error:

Error: aspida ERROR '_'id}.jso'' does not match '/^_[a-zA-Z][a-zA-Z0-9_]*(@number|@string)?((\.|%[0-9a-fA-F]{2})[a-zA-Z0-9]+)?$/'.

In current Rails applications, it is a common practice to maintain existing routes and use the .json extension to distinguish between HTML and JSON responses. This issue is particularly pronounced in API designs that include dynamic .json paths and the inability to generate API clients using openapi2aspida for these paths could significantly impact practical development workflows. Addressing this issue is crucial for maintaining compatibility with existing Rails conventions and supporting a wider range of API design practices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions