swagger-api / swagger-api/swagger-codegen

[PHP] allOf problem with the same field names in different models

Open
#10,897 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

To try resolve problem https://github.com/swagger-api/swagger-codegen/issues/10896 in yaml try to use allOf; Codegen creates duplications methods.

protected static $getters = [
....
'is_catchall' => 'getIsCatchall',
....
'is_catch_all' => 'getIsCatchAll',
....  ];

public function getIsCatchall()
{
    return $this->container['is_catchall'];
}

public function getIsCatchAll()
{
    return $this->container['is_catch_all'];
}
Swagger-codegen version

3.0.24

Swagger declaration file content or url

<https://github.com/go-email-validator/email-validator-sdk/blob/e99fe82d3c9d6d520687cf499688112e86acfe03/ev.openapiv3.yaml#L227

Command line used for generation
  docker run --rm -v ${PWD}/php:/local/out -v $(OPENAPI_PATH):/local/openapi.yaml swaggerapi/swagger-codegen-cli-v3:latest generate \
    -i /local/openapi.yaml \
    -l php \
    -o /local/out/

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 OpenAPI declaration at the linked ev.openapiv3.yaml location and reproduce generation with the documented Docker command using swagger-codegen-cli-v3:latest. Inspect the generated PHP getters and static getter map; done means an allOf case with the two field names does not create duplicate methods or mappings.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, php
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.