forked from loafle/openapi-generator-original
add requiredVars and optionalVars for codegen model
This commit is contained in:
parent
5a6fb39aa5
commit
a281afaebf
@ -18,6 +18,8 @@ public class CodegenModel {
|
||||
public String discriminator;
|
||||
public String defaultValue;
|
||||
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<String> allowableValues;
|
||||
|
||||
|
@ -2307,6 +2307,12 @@ public class DefaultCodegen {
|
||||
addImport(m, cp.baseType);
|
||||
addImport(m, cp.complexType);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -755,6 +755,9 @@ definitions:
|
||||
type: object
|
||||
required:
|
||||
- number
|
||||
- byte
|
||||
- date
|
||||
- password
|
||||
properties:
|
||||
integer:
|
||||
type: integer
|
||||
|
@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git
|
||||
|
||||
- API 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
|
||||
|
||||
## Requirements
|
||||
|
@ -10,11 +10,11 @@ Name | Type | Description | Notes
|
||||
**float** | **float** | | [optional]
|
||||
**double** | **double** | | [optional]
|
||||
**string** | **string** | | [optional]
|
||||
**byte** | **string** | | [optional]
|
||||
**byte** | **string** | |
|
||||
**binary** | **string** | | [optional]
|
||||
**date** | [**\DateTime**](Date.md) | | [optional]
|
||||
**date** | [**\DateTime**](Date.md) | |
|
||||
**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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user