Skip to content

fix(php-nextgen): always return if not void #21119

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

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

simPod
Copy link
Contributor

@simPod simPod commented Apr 22, 2025

We're missing return statements if return type is not void, Since in that case the method returns either {{{returnType}}} or Error object:

    public function deleteZone(
        string $serverId,
        string $zoneId,
        string $contentType = self::contentTypes['deleteZone'][0]
    ): \My\Project\OpenApi\DnsInt\Model\Error
    {
        $this->deleteZoneWithHttpInfo($serverId, $zoneId, $contentType);
    }

for

paths:
  "/error":
    get:
      summary: Will always generate an error
      operationId: error
      responses: &commonErrors
        "400":
          description: The supplied request was not valid
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: Requested item was not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "422":
          description: The input to the operation was not valid
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  "/servers/{server_id}/zones/{zone_id}":
    delete:
      summary: Deletes this zone, all attached metadata and rrsets.
      operationId: deleteZone
      tags:
        - zones
      parameters:
        - name: server_id
          in: path
          required: true
          description: The id of the server to retrieve
          schema:
            type: string
        - name: zone_id
          in: path
          required: true
          description: The id of the zone to retrieve
          schema:
            type: string
      responses:
        "204":
          description: "Returns 204 No Content on success."
        <<: *commonErrors
PR checklist
  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@wing328
Copy link
Member

wing328 commented Apr 23, 2025

thanks for the pr

what about adding a test endpoint to modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml?

@simPod
Copy link
Contributor Author

simPod commented Apr 23, 2025

Thanks for the file pointer. I have adjusted the definition.

@wing328 wing328 merged commit d4d1420 into OpenAPITools:master Apr 23, 2025
15 checks passed
@simPod simPod deleted the php-void branch April 23, 2025 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants