Badgerati / Pode

Pode is a Cross-Platform PowerShell web framework for creating REST APIs, Web Sites, and TCP/SMTP servers
https://badgerati.github.io/Pode
MIT License
830 stars 92 forks source link

Missing Minimum and Maximum Property in OpenAPI Generation #1365

Closed mdaneri closed 2 weeks ago

mdaneri commented 1 month ago

Bug Report: Missing Minimum Property in OpenAPI Generation

Describe the Bug

The -Minimum and -Maximum parameters are not converted to the appropriate properties in the OpenAPI specification when the value is 0.

Steps To Reproduce

  1. Run the following PowerShell command:

    New-PodeOANumberProperty -Name 'Progress' -Description 'The async operation percentage progress' -Minimum 0 -Maximum 100
  2. This generates the following OpenAPI YAML:

    Progress: 
      type: number
      description: The async operation percentage progress
      maximum: 100

The minimum property is missing in the generated YAML.

Expected Behavior

The generated OpenAPI YAML should include both the minimum and maximum properties when they are specified, even if the value is 0. The corrected YAML should look like this:

Progress: 
  type: number
  description: The async operation percentage progress
  minimum: 0
  maximum: 100