Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Union[Unset, datetime.date] is not allowed in header

Open
#881 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api, tooling

Research direction

No repository files or tests are named. Start by reproducing generation with the linked OpenAPI spec and tracing handling of the IF-MODIFIED-SINCE header parameter; inspect how string dates are represented in generated headers. Done means the endpoint generates successfully without the Union[Unset, datetime.date] error, with a tested representation for the date header.

Written by the indexing model from the issue text.

Description

🐞bug

Describe the bug
The parameter name='IF-MODIFIED-SINCE' produces an error 'Union[Unset, datetime.date] is not allowed in header', which prevents the endpoint from being generated.

OpenAPI Spec File
https://docs.developers.clio.com/openapi.json

Desktop (please complete the following information):

  • OS: macOS 13.4.1
  • Python Version: 3.12
  • openapi-python-client version: 0.15.2

Additional context
The parameter schema is:
"schema": {
"type": "string", (the format in "YYYY-MM-DD")
"format": "date" (the format defined by full-date in RFC3339)
}
The client generator is attempting to map this schema to a Python Union type, the union of Unset and datetime.date, which is not allowed or fitting in a HTTP header. Maybe string dates need to be transformed to datetime objects and vice versa? Or the date could be converted to a string before setting the header? At least that's my limited understanding of the situation.

Dominant language
Python
Stars
2k
Forks
293
Avg merge
34m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openapi-generators/openapi-python-client

All issues in openapi-generators/openapi-python-client

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.