Skip to content
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

[BUG] Default Python datetimeFormat is not RFC3339 compliant #20961

Open
5 of 6 tasks
andrewsartor opened this issue Mar 25, 2025 · 0 comments
Open
5 of 6 tasks

[BUG] Default Python datetimeFormat is not RFC3339 compliant #20961

andrewsartor opened this issue Mar 25, 2025 · 0 comments

Comments

@andrewsartor
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

OpenAPI documentation suggests that both date and date-time formats should be RFC3339 compliant, but the default for Python is not, as it is missing a colon in the timezone offset field. (%Y-%m-%dT%H:%M:%S%z).

openapi-generator version

7.11.0

OpenAPI declaration file content or url
timestamp:
    type: string
    format: date-time
Generation Details
Steps to reproduce

Add a date-time formatted string field as a parameter, the generated python code will send timestamps in the format (%Y-%m-%dT%H:%M:%S%z) e.g. 2025-03-25T12:32:00+0900

Related issues/PRs
Suggest a fix

In Python 3.12+, changing the %z directive to %:z will add a colon to the timezone offset, making the timestamp RFC3339 compliant.

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

No branches or pull requests

1 participant