-
Notifications
You must be signed in to change notification settings - Fork 989
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
docs/api: clean up Upload API docs slightly #17514
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: William Woodruff <william@trailofbits.com>
by underscores. Additionally, multiple-use fields (like `Classifier`) | ||
are pluralized. | ||
|
||
The table below provides examples: | ||
|
||
| Metadata field | Form field | | ||
|----------------|------------| | ||
| `Description-Content-Type` | `description_content_type` | | ||
| `License-File` | `license_files` | | ||
| `Classifier` | `classifiers` | | ||
|
||
!!! warning | ||
|
||
The transformation above *must* be performed. | ||
Sending a form field like `Description-Content-Type` will not raise an | ||
error but will be **silently ignored**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is exactly true or if there are some edge cases. I haven't looked closely but some fields are getting mapped here while others like classifier
/classifiers
aren't:
warehouse/warehouse/forklift/metadata.py
Lines 270 to 276 in 80d26fd
# Map Form fields to RawMetadata | |
_override = { | |
"platforms": "platform", | |
"supported_platforms": "supported_platform", | |
"license_files": "license_file", | |
} | |
_FORM_TO_RAW_MAPPING = {_override.get(k, k): k for k in _RAW_TO_EMAIL_MAPPING} |
This is an attempt to clean up the Upload API docs (very) slightly, as well as document some other well-known edge cases/discrepancies between the metadata layout and the POST form layout.
Key changes:
Classifier -> classifiers
). Also added a table visualizing the different cases.pyversion
Python tags.I think this (along with the other recent upload API doc changes) is sufficient to close #3151 🙂