OpenAPITools / OpenAPITools/openapi-generator

[BUG][PHP] single quotes in path should be escaped

Open
#22,305 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

After generation i end up with php errors because the single quotes in the path are not escaped.

$resourcePath = '/Accounts('{AccountID}')';

This is the path in the openapi.json
"/Accounts('{AccountID}')"

openapi-generator version

latest openapitools/openapi-generator-cli ( docker )

OpenAPI declaration file content or url

https://api.sap.com/odata/1.0/catalog.svc/APIContent.APIs('UT_ERP_ISU_UMC_0001')/$value?type=json

Swagger:
https://api.sap.com/api/UT_ERP_ISU_UMC_0001/resource/Accounts

Generation Details
Steps to reproduce

Grab the json and run

 docker run --rm     -v $PWD:/local openapitools/openapi-generator-cli generate     -i /local/openapi.json     -g php     -o /local/out/php
Related issues/PRs
Suggest a fix

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided OpenAPI declaration and run the Docker PHP generation command to reproduce the invalid $resourcePath output. Inspect the generated PHP handling for paths containing single quotes; done means the generated client contains valid PHP with those path quotes escaped.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.