Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 of 3 tasks
KiichiSugihara opened this issue Feb 15, 2024 · 0 comments
Open
1 of 3 tasks

Comments

@KiichiSugihara
Copy link

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.

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

No branches or pull requests

1 participant