Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

[BUG] String enum of '08' and '09 ' are wrong bundled #88

Open
AlfaCoder opened this issue Apr 28, 2023 · 1 comment
Open

[BUG] String enum of '08' and '09 ' are wrong bundled #88

AlfaCoder opened this issue Apr 28, 2023 · 1 comment

Comments

@AlfaCoder
Copy link

Description
I need enums of strings, but in the bundled openapi.yaml I get an incorrect enum-value for '08' and '09'.
The apostrophe in the bundled openapi.yaml is removed for this values... I have no idea

swagger-cli version
4.0.4

OpenAPI declaration file content or url
any-title-here.yml

title: AnyTitleHere
type: string
example: 70
enum:
  - '02'
  - '03'
  - '04'
  - '05'
  - '06'
  - '07'
  - '08'
  - '09'
  - '10'
  - '11'
  - '12'
  - '13'
  - '15'
  - '16'

generated openapi.yaml

title: AnyTitleHere
type: string
example: 70
enum:
  - '02'
  - '03'
  - '04'
  - '05'
  - '06'
  - '07'
  - 08
  - 09
  - '10'
  - '11'
  - '12'
  - '13'
  - '15'
  - '16'
@arnour
Copy link

arnour commented May 10, 2023

Based on my understanding, the issue appears to be related to the use of the octal number system. Specifically, any numbers with any digit greater than seven are being parsed incorrectly.

The octal number system is a base-8 numeral system that uses eight digits (0-7). When a number is written with a leading zero, it is interpreted as an octal number. However, if the number contains any digit greater than seven, it exceeds the maximum value that can be represented in the octal system and may result in parsing errors.

Therefore, in your case, it is likely that the numbers with digits greater than seven are being interpreted as octal numbers and causing the parsing issues. To address this problem, you may need to consider using a different numbering system or modifying the way the numbers are represented to avoid the limitations of the octal system.

I have found the same issue with values such as '080', '090', '0008', etc.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants