Skip to content

Commit 3beeb4e

Browse files
fMadswing328
authored andcommitted
#126: Not-required properties now shows as nullable (#129)
1 parent c30afdf commit 3beeb4e

48 files changed

Lines changed: 2182 additions & 169 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/resources/php/model_generic.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
267267
/**
268268
* Gets {{name}}
269269
*
270-
* @return {{dataType}}
270+
* @return {{dataType}}{{^required}}|null{{/required}}
271271
*/
272272
public function {{getter}}()
273273
{
@@ -277,7 +277,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
277277
/**
278278
* Sets {{name}}
279279
*
280-
* @param {{dataType}} ${{name}}{{#description}} {{{description}}}{{/description}}{{^description}} {{{name}}}{{/description}}
280+
* @param {{dataType}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{description}}}{{/description}}{{^description}} {{{name}}}{{/description}}
281281
*
282282
* @return $this
283283
*/
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
return Symfony\CS\Config::create()
4+
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
5+
->setUsingCache(true)
6+
->fixers(
7+
[
8+
'ordered_use',
9+
'phpdoc_order',
10+
'short_array_syntax',
11+
'strict',
12+
'strict_param'
13+
]
14+
)
15+
->finder(
16+
Symfony\CS\Finder\DefaultFinder::create()
17+
->in(__DIR__)
18+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: php
2+
sudo: false
3+
php:
4+
- 5.4
5+
- 5.5
6+
- 5.6
7+
- 7.0
8+
- hhvm
9+
before_install: "composer install"
10+
script: "vendor/bin/phpunit"
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# OpenAPIClient-php
2+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
3+
4+
This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
5+
6+
- API version: 1.0.0 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
7+
- Build package: org.openapitools.codegen.languages.PhpClientCodegen
8+
9+
## Requirements
10+
11+
PHP 5.5 and later
12+
13+
## Installation & Usage
14+
### Composer
15+
16+
To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`:
17+
18+
```
19+
{
20+
"repositories": [
21+
{
22+
"type": "git",
23+
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
24+
}
25+
],
26+
"require": {
27+
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
28+
}
29+
}
30+
```
31+
32+
Then run `composer install`
33+
34+
### Manual Installation
35+
36+
Download the files and include `autoload.php`:
37+
38+
```php
39+
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
40+
```
41+
42+
## Tests
43+
44+
To run the unit tests:
45+
46+
```
47+
composer install
48+
./vendor/bin/phpunit
49+
```
50+
51+
## Getting Started
52+
53+
Please follow the [installation procedure](#installation--usage) and then run the following:
54+
55+
```php
56+
<?php
57+
require_once(__DIR__ . '/vendor/autoload.php');
58+
59+
$apiInstance = new OpenAPI\Client\Api\FakeApi(
60+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
61+
// This is optional, `GuzzleHttp\Client` will be used as default.
62+
new GuzzleHttp\Client()
63+
);
64+
$unknown_base_type = new \OpenAPI\Client\Model\UNKNOWN_BASE_TYPE(); // object |
65+
66+
try {
67+
$apiInstance->testCodeInjectEndRnNR($unknown_base_type);
68+
} catch (Exception $e) {
69+
echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL;
70+
}
71+
72+
?>
73+
```
74+
75+
## Documentation for API Endpoints
76+
77+
All URIs are relative to *petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*
78+
79+
Class | Method | HTTP request | Description
80+
------------ | ------------- | ------------- | -------------
81+
*FakeApi* | [**testCodeInjectEndRnNR**](docs/Api/FakeApi.md#testcodeinjectendrnnr) | **PUT** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
82+
83+
84+
## Documentation For Models
85+
86+
- [ModelReturn](docs/Model/ModelReturn.md)
87+
88+
89+
## Documentation For Authorization
90+
91+
92+
## api_key
93+
94+
- **Type**: API key
95+
- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
96+
- **Location**: HTTP header
97+
98+
## petstore_auth
99+
100+
- **Type**: OAuth
101+
- **Flow**: implicit
102+
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
103+
- **Scopes**:
104+
- **write:pets**: modify pets in your account *_/ ' \" =end -- \\r\\n \\n \\r
105+
- **read:pets**: read your pets *_/ ' \" =end -- \\r\\n \\n \\r
106+
107+
108+
## Author
109+
110+
something@something.abc *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
111+
112+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "GIT_USER_ID/GIT_REPO_ID",
3+
"description": "",
4+
"keywords": [
5+
"openapitools",
6+
"openapi-generator",
7+
"php",
8+
"sdk",
9+
"rest",
10+
"api"
11+
],
12+
"homepage": "http://openapi-generator.tech",
13+
"license": "proprietary",
14+
"authors": [
15+
{
16+
"name": "OpenAPI-Generator contributors",
17+
"homepage": "https://openapi-generator.tech"
18+
}
19+
],
20+
"require": {
21+
"php": ">=5.5",
22+
"ext-curl": "*",
23+
"ext-json": "*",
24+
"ext-mbstring": "*",
25+
"guzzlehttp/guzzle": "^6.2"
26+
},
27+
"require-dev": {
28+
"phpunit/phpunit": "^4.8",
29+
"squizlabs/php_codesniffer": "~2.6",
30+
"friendsofphp/php-cs-fixer": "~1.12"
31+
},
32+
"autoload": {
33+
"psr-4": { "OpenAPI\\Client\\" : "lib/" }
34+
},
35+
"autoload-dev": {
36+
"psr-4": { "OpenAPI\\Client\\" : "test/" }
37+
}
38+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# OpenAPI\Client\FakeApi
2+
3+
All URIs are relative to *petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*
4+
5+
Method | HTTP request | Description
6+
------------- | ------------- | -------------
7+
[**testCodeInjectEndRnNR**](FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
8+
9+
10+
# **testCodeInjectEndRnNR**
11+
> testCodeInjectEndRnNR($unknown_base_type)
12+
13+
To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
14+
15+
### Example
16+
```php
17+
<?php
18+
require_once(__DIR__ . '/vendor/autoload.php');
19+
20+
$apiInstance = new OpenAPI\Client\Api\FakeApi(
21+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
22+
// This is optional, `GuzzleHttp\Client` will be used as default.
23+
new GuzzleHttp\Client()
24+
);
25+
$unknown_base_type = new \OpenAPI\Client\Model\UNKNOWN_BASE_TYPE(); // object |
26+
27+
try {
28+
$apiInstance->testCodeInjectEndRnNR($unknown_base_type);
29+
} catch (Exception $e) {
30+
echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL;
31+
}
32+
?>
33+
```
34+
35+
### Parameters
36+
37+
Name | Type | Description | Notes
38+
------------- | ------------- | ------------- | -------------
39+
**unknown_base_type** | [**object**](../Model/UNKNOWN_BASE_TYPE.md)| | [optional]
40+
41+
### Return type
42+
43+
void (empty response body)
44+
45+
### Authorization
46+
47+
No authorization required
48+
49+
### HTTP request headers
50+
51+
- **Content-Type**: application/json, *_/ \" =end --
52+
- **Accept**: Not defined
53+
54+
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
55+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ModelReturn
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**return** | **int** | property description *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r | [optional]
7+
8+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
9+
10+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/sh
2+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3+
#
4+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
5+
6+
git_user_id=$1
7+
git_repo_id=$2
8+
release_note=$3
9+
10+
if [ "$git_user_id" = "" ]; then
11+
git_user_id="GIT_USER_ID"
12+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
13+
fi
14+
15+
if [ "$git_repo_id" = "" ]; then
16+
git_repo_id="GIT_REPO_ID"
17+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
18+
fi
19+
20+
if [ "$release_note" = "" ]; then
21+
release_note="Minor update"
22+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
23+
fi
24+
25+
# Initialize the local directory as a Git repository
26+
git init
27+
28+
# Adds the files in the local repository and stages them for commit.
29+
git add .
30+
31+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
32+
git commit -m "$release_note"
33+
34+
# Sets the new remote
35+
git_remote=`git remote`
36+
if [ "$git_remote" = "" ]; then # git remote not defined
37+
38+
if [ "$GIT_TOKEN" = "" ]; then
39+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
40+
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
41+
else
42+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
43+
fi
44+
45+
fi
46+
47+
git pull origin master
48+
49+
# Pushes (Forces) the changes in the local repository up to the remote repository
50+
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
51+
git push origin master 2>&1 | grep -v 'To https'
52+

0 commit comments

Comments
 (0)