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

[Schema Inaccuracy] actions/list-workflow-runs's created parameter is not a date-time #2088

Open
chantra opened this issue Jan 24, 2023 · 1 comment

Comments

@chantra
Copy link

chantra commented Jan 24, 2023

Schema Inaccuracy

The created parameter of actions/list-workflow-runs operation is currently set to "$ref": "#/components/parameters/created" which has the following format:

 "created": {                  
   "name": "created",          
   "in": "query",              
   "required": false,          
   "schema": {                 
     "type": "string",         
     "format": "date-time"     
   }                           
 },                            

This causes openapi code generator to treat is as a datetime, resulting in queries which send the query parameter formatted as a date-time when the service expect a date-time range as specified in Query for dates which essentially makes this parameter unusable,or only usable when one wants to fetch items created at an exact time.

An example of such automatically generated API client is octorust and we can see that the created parameter is expected to be a Datetime in list_workflow_runs.

Note: This likely apply to other operations that rely on similar syntax.

Expected

The format should either be left as a raw string, or being provided a custom format that consumers are up to handle natively, this way allowing a consumer to accept native date-time range and serialize to/deserialize from GH date-time range syntax.

Something along the lines of https://gist.github.com/chantra/ecc9a535ad8056eea6ef0a40bcc8a4df

Reproduction Steps

Currently, this causes queries to be formatted with created=2023-01-23T09:37:53-08:00, resulting in only workflows created at that specific date being returned.
e.g:

curl --silent "https://api.github.com/repos/github/rest-api-description/actions/workflows/linter.yml/runs?created=$(date --iso-8601=seconds -d '1 day ago')" | jq .total_count  
0

Preventing to capture queries such as:

$ curl --silent "https://api.github.com/repos/github/rest-api-description/actions/workflows/linter.yml/runs?created=>=$(date --iso-8601=seconds -d '1 day ago')" | jq .total_count        
4
chantra added a commit to chantra/oxidecomputer-third-party-api-clients that referenced this issue Jan 24, 2023
chantra added a commit to chantra/oxidecomputer-third-party-api-clients that referenced this issue Jan 31, 2023
…low_runs`'s `created` parameter.

The issue is described in more details in github/rest-api-description#2088

For now, this change will treat the created parameter as an optional
str, which it would probably do if the parameter had a custom format
defined.
Alternatively, one oculd try to implement a proper datetime rnage that
follows the [Query for
dates](https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates)
format, but this is maybe more work than one would benefit by
implementing the search formating on the user side.
@chantra
Copy link
Author

chantra commented Feb 6, 2023

cc @ahoglund and @becco whom I have seen triaging previous schema inaccuracy issues. Thanks

chantra added a commit to chantra/oxidecomputer-third-party-api-clients that referenced this issue Mar 14, 2023
…low_runs`'s `created` parameter.

The issue is described in more details in github/rest-api-description#2088

For now, this change will treat the created parameter as an optional
str, which it would probably do if the parameter had a custom format
defined.
Alternatively, one oculd try to implement a proper datetime rnage that
follows the [Query for
dates](https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates)
format, but this is maybe more work than one would benefit by
implementing the search formating on the user side.
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

2 participants