Skip to content

[Bug]: Number example treated as a string when generating swagger file. #5061

@SandorArpa

Description

@SandorArpa

Description of the problem/issue

The following mark up
`@SchemaProperty(
name = "price",
schema = @Schema(example = "9090", maximum = "10000000", type = "number", minimum = "1",
description = "Price override for the payment amount. If not present this will defaults to price of product.")) (https://github.com/alphagov/pay-products/blob/529c1873e6ff2e7842a63654aeb50d7d19cb1fda/src/main/java/uk/gov/pay/products/resources/PaymentResource.java#L107)

interpreted as a string in version 2.2.43:

type: number description: Price override for the payment amount. If not present this will defaults to price of product. example: "9090" maximum: 10000000 minimum: 1.

In version 2.2.42 it was interpreted as a number:
type: number description: Price override for the payment amount. If not present this will defaults to price of product. example: 9090 maximum: 10000000 minimum: 1.

Affected Version

2.2.42 to 2.2.43

Steps to Reproduce

Setup a SchemaProperty in a RequestBody where type = "number' and example = "1000"

Expected Behavior

Example is a number, not a string

Actual Behavior

Example is a string

Logs / Stack Traces

N/A

Additional Context

Change did not affect Java classes, eg:

@Schema(example = "1000.00") private final BigDecimal averageAmount;

is still interpreted as a number.

Checklist

  • I have searched the existing issues and this is not a duplicate.
  • [ x] I have provided sufficient information for maintainers to reproduce the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions