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

docs/api: clean up Upload API docs slightly #17514

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

woodruffw
Copy link
Member

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:

  • Made formatting more uniform: list items now mostly start with the field they're describing, instead of describing the field in free-form prose.
  • Elaborated on the description of how metadata is transformed into form fields, including a description of how multiple-use fields are pluralized (Classifier -> classifiers). Also added a table visualizing the different cases.
  • Added a clarifying link about the format of pyversion Python tags.
  • Replaced i.e. with e.g. where appropriate.

I think this (along with the other recent upload API doc changes) is sufficient to close #3151 🙂

Signed-off-by: William Woodruff <william@trailofbits.com>
Comment on lines +47 to +62
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**.
Copy link
Member

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:

# 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}

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

Successfully merging this pull request may close these issues.

Document data format for upload API
2 participants