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

[php-slim4] Add Mock Server #12044

Merged
merged 2 commits into from
Apr 9, 2022
Merged

Conversation

ybelenko
Copy link
Contributor

@ybelenko ybelenko commented Apr 5, 2022

Added Mock Server as fully pre-configured dev only feature.

UPD: how it looks like from the CURL
with production env:

$ curl --request GET \
>   --url 'http://phpslim4.test/v2/pet/findByStatus?status=available' \
>   --header 'accept: application/json' \
>   --header 'x-openapiserver-mock: ping'
{
    "message": "501 Not Implemented"
}

with development env:

$  curl --request GET \
>   --url 'http://phpslim4.test/v2/pet/findByStatus?status=available' \
>   --header 'accept: application/json' \
>   --header 'x-openapiserver-mock: ping'
[{"id":-8738629417578509312,"category":{"id":-4162503862215270400,"name":"Lorem ipsum dol"},"name":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem i","photoUrls":["Lor"],"tags":[{"id":-3506202845849391104,"name":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectet"}],"status":"pending"}]

with development env, but without required HTTP mock header:

$  curl --request GET \
>   --url 'http://phpslim4.test/v2/pet/findByStatus?status=available' \
>   --header 'accept: application/json'
{
    "message": "501 Not Implemented",
    "exception": [
        {
            "type": "Slim\\Exception\\HttpNotImplementedException",
            "code": 501,
            "message": "How about extending AbstractPetApi by OpenAPIServer\\Api\\PetApi class implementing findPetsByStatus as a GET method?",
            "file": "/Users/ybelenko/Sites/openapi-generator/samples/server/petstore/php-slim4/lib/App/RegisterRoutes.php",
            "line": 861
        }
    ]
}

cc @jebentier @dkarlovi @mandrean @jfastnacht @renepardon

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 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

ybelenko added 2 commits April 5, 2022 05:49
New 1.2.0 version of the package contains required factory class.
@wing328
Copy link
Member

wing328 commented Apr 9, 2022

Samples not up-to-date failure already fixed in the master.

@wing328 wing328 merged commit cd56a4b into OpenAPITools:master Apr 9, 2022
@wing328 wing328 added this to the 6.0.0 milestone Apr 9, 2022
@ybelenko ybelenko deleted the phpslim4_mock_server branch April 9, 2022 05:14
cachescrubber pushed a commit to cachescrubber/openapi-generator that referenced this pull request Apr 9, 2022
* Setup Data Mocker as dev dependency

New 1.2.0 version of the package contains required factory class.

* Refresh samples
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