Skip to content

Add DecimalTypeObject to test-integration (#143) #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

meanstigerkim
Copy link
Contributor

Decimal Type was tested.
Is it right to do it this way?
It comes up as a double type with json.
decimal type

@ghost
Copy link

ghost commented Sep 11, 2021

CLA assistant check
All CLA requirements met.

@meanstigerkim meanstigerkim changed the title Add DecimalTypeObject to test-integration #143 Add DecimalTypeObject to test-integration (#143) Sep 11, 2021
Copy link
Contributor

@justinyoo justinyoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@minbumm Thanks for your PR!

I've left a few comments with regards to mainly to take care of the request payload. In addition to that, I was wondering where your test codes are. Would you please add it?


namespace Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp
{
public class Get_ApplicationJson_DecimalType_HttpTrigger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change both file name and class name to Post_ApplicationJson_DecimalType_HttpTrigger?

{
[FunctionName(nameof(Get_ApplicationJson_DecimalType_HttpTrigger))]
[OpenApiOperation(operationId: nameof(Get_ApplicationJson_DecimalType_HttpTrigger.Get_ApplicationJson_DecimalType), tags: new[] { "dataType" })]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DecimalTypeObjectModel), Description = "The OK response")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need the OpenApiRequestBody(...) attribute for the request payload.

@justinyoo
Copy link
Contributor

Decimal Type was tested.
Is it right to do it this way?
It comes up as a double type with json.
decimal type

decimal data type is not declared on the spec, it's considered as number with the format of double.

@justinyoo justinyoo added the enhancement New feature or request label Sep 14, 2021
@meanstigerkim
Copy link
Contributor Author

Add Model : test-integration2/TestApps/Models/DecimalTypeObjectModel.cs
Add HttpTrigger to test : test-integration2/TestApps/Post_ApplicationJson_DecimalType_HttpTrigger.cs
I add HttpTrigger about Decimal Type to the TestApp.

…ntTypeSchema -> modified(propertyType ->propertyFormat)
@meanstigerkim meanstigerkim marked this pull request as draft September 23, 2021 00:55
@meanstigerkim meanstigerkim marked this pull request as ready for review September 23, 2021 01:32
Copy link
Contributor

@Deserve82 Deserve82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote some reviews, please check your http trigger app with these reviews.

@@ -18,6 +18,7 @@ public class Post_ApplicationJson_DecimalType_HttpTrigger
{
[FunctionName(nameof(Post_ApplicationJson_DecimalType_HttpTrigger))]
[OpenApiOperation(operationId: nameof(Post_ApplicationJson_DecimalType_HttpTrigger.Post_ApplicationJson_DecimalType), tags: new[] { "demical" })]
[OpenApiRequestBody(contentType: "application/octet-stream", bodyType: typeof(decimal), Required = true, Description = "The OK response")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contentType does not match with your test DataRow.
I think contentType should be "text/plain", not application/octet-stream

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll give it a try

}

[DataTestMethod]
[DataRow("/post-applicationjson-decimal", "post", "text/plain", "number", "decimal")]
Copy link
Contributor

@Deserve82 Deserve82 Sep 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a problem. Now data row has "decimal" value in propertyFormat, but the format of your app does not have any "decimal" format. I think it's better to change "decimal" to "double"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll give it a try

}

[DataTestMethod]
[DataRow("/post-applicationjson-decimal", "post", "200", "application/json", "decimalObjectModel")]
Copy link
Contributor

@Deserve82 Deserve82 Sep 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same problem with "decimalObjectModel". you wrote your model type name "decimalTypeObjectModel". Please change this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks i fixed it

}

[DataTestMethod]
[DataRow("decimaleObjectModel", "object")]
Copy link
Contributor

@Deserve82 Deserve82 Sep 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same problem with "decimalObjectModel". you wrote your model type name "decimalTypeObjectModel". Please change this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks i fixed it

}

[DataTestMethod]
[DataRow("decimalObjectModel", "decimalValue", "number", "decimal")]
Copy link
Contributor

@Deserve82 Deserve82 Sep 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same problem with "decimalObjectModel". you wrote your model type name "decimalTypeObjectModel". Please change this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks i fixed it

@meanstigerkim
Copy link
Contributor Author

I made the mistake of doing the revert.

meanstigerkim pushed a commit to meanstigerkim/azure-functions-openapi-extension that referenced this pull request Oct 5, 2021
@justinyoo justinyoo added invalid and removed enhancement New feature or request labels Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants