add requiredVars and optionalVars for codegen model

This commit is contained in:
wing328 2016-04-23 22:48:24 +08:00
parent 5a6fb39aa5
commit a281afaebf
5 changed files with 15 additions and 4 deletions

View File

@ -18,6 +18,8 @@ public class CodegenModel {
public String discriminator; public String discriminator;
public String defaultValue; public String defaultValue;
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>(); public List<CodegenProperty> vars = new ArrayList<CodegenProperty>();
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
public List<CodegenProperty> allVars; public List<CodegenProperty> allVars;
public List<String> allowableValues; public List<String> allowableValues;

View File

@ -2307,6 +2307,12 @@ public class DefaultCodegen {
addImport(m, cp.baseType); addImport(m, cp.baseType);
addImport(m, cp.complexType); addImport(m, cp.complexType);
vars.add(cp); vars.add(cp);
if (Boolean.TRUE.equals(cp.required)) { // if required, add to the list "requiredVars"
m.requiredVars.add(cp);
} else { // else add to the list "optionalVars" for optional property
m.optionalVars.add(cp);
}
} }
} }
} }

View File

@ -755,6 +755,9 @@ definitions:
type: object type: object
required: required:
- number - number
- byte
- date
- password
properties: properties:
integer: integer:
type: integer type: integer

View File

@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git
- API version: 1.0.0 - API version: 1.0.0
- Package version: 1.0.0 - Package version: 1.0.0
- Build date: 2016-04-23T16:49:49.572+08:00 - Build date: 2016-04-23T22:48:00.795+08:00
- Build package: class io.swagger.codegen.languages.PhpClientCodegen - Build package: class io.swagger.codegen.languages.PhpClientCodegen
## Requirements ## Requirements

View File

@ -10,11 +10,11 @@ Name | Type | Description | Notes
**float** | **float** | | [optional] **float** | **float** | | [optional]
**double** | **double** | | [optional] **double** | **double** | | [optional]
**string** | **string** | | [optional] **string** | **string** | | [optional]
**byte** | **string** | | [optional] **byte** | **string** | |
**binary** | **string** | | [optional] **binary** | **string** | | [optional]
**date** | [**\DateTime**](Date.md) | | [optional] **date** | [**\DateTime**](Date.md) | |
**date_time** | [**\DateTime**](\DateTime.md) | | [optional] **date_time** | [**\DateTime**](\DateTime.md) | | [optional]
**password** | **string** | | [optional] **password** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)