mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-28 11:40:52 +00:00
* Run ./bin/utils/ensure-up-to-date to re-generate samples run in the CI. * Fixed issue #1126. DefaultCodegen now sets the hasChildren property of CodegenModel when children models are added to the model. Changed the modelGeneric.mustache template to decide whether to include a base validation model (for children to inherit) based on the hasChildren property, and not the discriminator property. * Run the ./bin/utils/ensure-up-to-date script after fixing the issue #1126 * Reverted modification in go samples, performed by ./bin/utils/ensure-up-to-date, that are failing in CI. This partially reverts commit 2168df0f82d987ff8d50963d34efb269b015ef98.
This commit is contained in:
parent
12a702ee07
commit
ded765bcb9
@ -239,6 +239,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
parent.setChildren(new ArrayList<CodegenModel>());
|
||||
}
|
||||
parent.getChildren().add(cm);
|
||||
parent.hasChildren = true;
|
||||
if (parent.getDiscriminator() == null) {
|
||||
parent = allModels.get(parent.getParent());
|
||||
} else {
|
||||
|
@ -217,7 +217,7 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
|
||||
|
||||
{{/generatePropertyChanged}}
|
||||
{{#validatable}}
|
||||
{{#discriminator}}
|
||||
{{#hasChildren}}
|
||||
/// <summary>
|
||||
/// To validate all properties of the instance
|
||||
/// </summary>
|
||||
@ -235,8 +235,8 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
|
||||
/// <returns>Validation Result</returns>
|
||||
protected IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> BaseValidate(ValidationContext validationContext)
|
||||
{
|
||||
{{/discriminator}}
|
||||
{{^discriminator}}
|
||||
{{/hasChildren}}
|
||||
{{^hasChildren}}
|
||||
/// <summary>
|
||||
/// To validate all properties of the instance
|
||||
/// </summary>
|
||||
@ -244,11 +244,11 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
|
||||
/// <returns>Validation Result</returns>
|
||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||
{
|
||||
{{/discriminator}}
|
||||
{{/hasChildren}}
|
||||
{{#parent}}
|
||||
{{^isArrayModel}}
|
||||
{{^isMapModel}}
|
||||
foreach(var x in BaseValidate(validationContext)) yield return x;
|
||||
foreach(var x in base.BaseValidate(validationContext)) yield return x;
|
||||
{{/isMapModel}}
|
||||
{{/isArrayModel}}
|
||||
{{/parent}}
|
||||
|
@ -123,7 +123,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <returns>Validation Result</returns>
|
||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||
{
|
||||
foreach(var x in BaseValidate(validationContext)) yield return x;
|
||||
foreach(var x in base.BaseValidate(validationContext)) yield return x;
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ namespace Org.OpenAPITools.Model
|
||||
/// <returns>Validation Result</returns>
|
||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||
{
|
||||
foreach(var x in BaseValidate(validationContext)) yield return x;
|
||||
foreach(var x in base.BaseValidate(validationContext)) yield return x;
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user