You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
If a property is defined as a number and range validation is specified but only using the minimum property an exception is thrown during generation of the api.
To Reproduce
Steps to reproduce the behavior:
Modify the sample project to have the beflow definition for the Order type where myNumber only has minimum specified:
Run the generator
The following error is returned: "Cannot parse value as number (Parameter 'value')"
Expected behavior
Code is generated with range validation from specified minimum (1.1) to infinite.
Order definition
Order:
title: Order
description: |-
A single order.
Hallo description with multiline and no ending dot
type: object
x-examples:
MyExample:
id: 123
name: Hallo world
MyExample2: {}
properties:
id:
type: string
format: uuid
description:
type: string
myTime:
type: string
format: time
myEmail:
type: string
format: email
default: [email protected]
myNullableDateTime:
type: string
format: date-time
nullable: true
myDateTime:
type: string
format: date-time
myNumber:
type: number
minimum: 1.1
myInteger:
type: integer
maximum: 50
default: 15
myBool:
type: boolean
description: MyBool is great
myUri:
type: string
format: uri
description: 'This is the good uri :-)'
myByte:
type: string
format: byte
myStringList:
type: array
description: 'Hallo myStringList desc :-)'
items:
type: string
myLong:
type: integer
format: int64
minimum: 10
exclusiveMinimum: false
deliveryAddress:
$ref: '#/components/schemas/Address'
Exception details
at Atc.CodeAnalysis.CSharp.SyntaxFactories.SyntaxLiteralExpressionFactory.Create(String value, SyntaxKind syntaxKind) in /_/src/Atc.CodeAnalysis.CSharp/SyntaxFactories/SyntaxLiteralExpressionFactory.cs:line 35
at Atc.CodeAnalysis.CSharp.SyntaxFactories.SyntaxAttributeArgumentFactory.Create(Object attributeValue) in /_/src/Atc.CodeAnalysis.CSharp/SyntaxFactories/SyntaxAttributeArgumentFactory.cs:line 26
at Atc.CodeAnalysis.CSharp.SyntaxFactories.SyntaxAttributeFactory.CreateWithOneItemWithTwoArgument(String attributeName, Object argumentValue1, Object argumentValue2) in /_/src/Atc.CodeAnalysis.CSharp/SyntaxFactories/SyntaxAttributeFactory.cs:line 68
at Atc.CodeAnalysis.CSharp.SyntaxFactories.SyntaxAttributeFactory.CreateFromValidationAttribute(ValidationAttribute validationAttribute) in /_/src/Atc.CodeAnalysis.CSharp/SyntaxFactories/SyntaxAttributeFactory.cs:line 92
at Atc.CodeAnalysis.CSharp.PropertyDeclarationSyntaxExtensions.AddValidationAttribute(PropertyDeclarationSyntax propertyDeclaration, ValidationAttribute validationAttribute) in D:\Work\GitHub\atc-rest-api-generator\src\Atc.Rest.ApiGenerator\Extensions\PropertyDeclarationSyntaxExtensions.cs:line 99
at Atc.CodeAnalysis.CSharp.PropertyDeclarationSyntaxExtensions.RangeAttributeDouble(PropertyDeclarationSyntax propertyDeclaration, OpenApiSchema schema) in D:\Work\GitHub\atc-rest-api-generator\src\Atc.Rest.ApiGenerator\Extensions\PropertyDeclarationSyntaxExtensions.cs:line 311
at Atc.CodeAnalysis.CSharp.PropertyDeclarationSyntaxExtensions.AddValidationAttributeForMinMaxIfRequired(PropertyDeclarationSyntax propertyDeclaration, OpenApiSchema schema) in D:\Work\GitHub\atc-rest-api-generator\src\Atc.Rest.ApiGenerator\Extensions\PropertyDeclarationSyntaxExtensions.cs:line 190
at Atc.Rest.ApiGenerator.SyntaxFactories.SyntaxPropertyDeclarationFactory.CreateAuto(KeyValuePair`2 schema, ISet`1 requiredProperties, Boolean useNullableReferenceTypes) in D:\Work\GitHub\atc-rest-api-generator\src\Atc.Rest.ApiGenerator\SyntaxFactories\SyntaxPropertyDeclarationFactory.cs:line 115
at Atc.Rest.ApiGenerator.SyntaxGenerators.Api.SyntaxGeneratorContractModel.GenerateCode() in D:\Work\GitHub\atc-rest-api-generator\src\Atc.Rest.ApiGenerator\SyntaxGenerators\Api\SyntaxGeneratorContractModel.cs:line 138
at Atc.Rest.ApiGenerator.SyntaxGenerators.Api.SyntaxGeneratorContractModels.GenerateSyntaxTrees() in D:\Work\GitHub\atc-rest-api-generator\src\Atc.Rest.ApiGenerator\SyntaxGenerators\Api\SyntaxGeneratorContractModels.cs:line 69
at Atc.Rest.ApiGenerator.Generators.ServerApiGenerator.GenerateContracts(List`1 operationSchemaMappings) in D:\Work\GitHub\atc-rest-api-generator\src\Atc.Rest.ApiGenerator\Generators\ServerApiGenerator.cs:line 236
at Atc.Rest.ApiGenerator.Generators.ServerApiGenerator.Generate() in D:\Work\GitHub\atc-rest-api-generator\src\Atc.Rest.ApiGenerator\Generators\ServerApiGenerator.cs:line 51
at Atc.Rest.ApiGenerator.Helpers.GenerateHelper.GenerateServerApi(String projectPrefixName, DirectoryInfo outputPath, DirectoryInfo outputTestPath, Tuple`3 apiDocument, ApiOptions apiOptions) in D:\Work\GitHub\atc-rest-api-generator\src\Atc.Rest.ApiGenerator\Helpers\GenerateHelper.cs:line 79
at Atc.Rest.ApiGenerator.CLI.Commands.GenerateServerApiCommand.OnExecute(CommandLineApplication configCmd) in D:\Work\GitHub\atc-rest-api-generator\src\Atc.Rest.ApiGenerator.CLI\Commands\GenerateServerApiCommand.cs:line 42
The text was updated successfully, but these errors were encountered:
Description
If a property is defined as a number and range validation is specified but only using the minimum property an exception is thrown during generation of the api.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Code is generated with range validation from specified minimum (1.1) to infinite.
Order definition
Exception details
The text was updated successfully, but these errors were encountered: