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

Enabled write_only fields on bindings #613

Closed
wants to merge 1 commit into from
Closed

Conversation

fao89
Copy link
Member

@fao89 fao89 commented Mar 26, 2020

https://pulp.plan.io/issues/6346
closes #6346

Please be sure you have read our documentation on creating PRs:
https://docs.pulpproject.org/contributing/pull-request-walkthrough.html

@pulpbot
Copy link
Member

pulpbot commented Mar 26, 2020

Attached issue: https://pulp.plan.io/issues/6346

@fao89
Copy link
Member Author

fao89 commented Mar 26, 2020

write_only fields started to be hidden due to this issue:
https://pulp.plan.io/issues/5622

(pulp) [vagrant@pulp3-source-fedora30 pulp_rpm]$ http :/pulp/api/v3/content/rpm/repo_metadata_
files/
HTTP/1.1 200 OK
Allow: GET, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 468
Content-Type: application/json
Date: Thu, 26 Mar 2020 21:47:00 GMT
Server: nginx/1.16.1
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "artifact": "/pulp/api/v3/artifacts/b6514ffb-5352-463b-912a-fe0e79ed2371/",
            "checksum": "521f322f05f9802f2438d8bb7d97558c64ff3ff74c03322d77787ade9152d8bb",
            "checksum_type": "sha256",
            "data_type": "group",
            "pulp_created": "2020-03-26T21:46:27.812444Z",
            "pulp_href": "/pulp/api/v3/content/rpm/repo_metadata_files/5a47cc9a-2b5a-46e6-9cd1-dd7d129035cc/",
            "sha256": "521f322f05f9802f2438d8bb7d97558c64ff3ff74c03322d77787ade9152d8bb"
        }
    ]
}

current doc matches with what you see on DRF browsable and httpie: https://pulp-rpm.readthedocs.io/en/latest/restapi.html#operation/content_rpm_repo_metadata_files_list

with this PR, doc would return:

{
  "count": 0,
  "next": "http://example.com",
  "previous": "http://example.com",
  "results": [
    {
      "pulp_href": "http://example.com",
      "pulp_created": "2020-03-26T21:32:34Z",
      "artifact": "http://example.com",
      "relative_path": "string",
      "file": "string",
      "repository": "http://example.com",
      "data_type": "string",
      "checksum_type": "string",
      "checksum": "string",
      "sha256": "string"
    }
  ]
}

which has: repository, file and relative_path, that user will never see DRF browser/httpie response. This could mislead the users, as it did on the issue I mentioned.

@fao89
Copy link
Member Author

fao89 commented Mar 26, 2020

not hiding write_only fields makes rest api docs diverge from DRF browsable API / httpie responses:

(pulp) [vagrant@pulp3-source-fedora30 pulp_rpm]$ http :/pulp/api/v3/remotes/rpm/rpm/8aab58c0-0b9f-4c99-9f13-8c1080831f42/
HTTP/1.1 200 OK
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 422
Content-Type: application/json
Date: Thu, 26 Mar 2020 21:49:51 GMT
Server: nginx/1.16.1
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "ca_cert": null,
    "client_cert": null,
    "client_key": null,
    "download_concurrency": 20,
    "name": "53ac1678-bebf-45eb-9dab-a5cebe849fe7",
    "policy": "on_demand",
    "proxy_url": null,
    "pulp_created": "2020-03-26T21:46:06.729011Z",
    "pulp_href": "/pulp/api/v3/remotes/rpm/rpm/8aab58c0-0b9f-4c99-9f13-8c1080831f42/",
    "pulp_last_updated": "2020-03-26T21:46:06.729027Z",
    "tls_validation": true,
    "url": "http://mirror.linux.duke.edu/pub/centos/7/os/x86_64/"
}

with that in mind I vote to reopen: #600

@dkliban
Copy link
Member

dkliban commented Apr 14, 2020

@fabricio-aguiar Let's close this PR in favor of #600.

@fao89
Copy link
Member Author

fao89 commented Apr 14, 2020

Closing in favor of #600

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

Successfully merging this pull request may close these issues.

3 participants