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

In the api doc, the 'dimension' attribute of the /api/projects endpoint (post,patch) is marked as writable. #4367

Closed
2 tasks done
k1won opened this issue Feb 20, 2022 · 2 comments
Assignees
Labels
bug Something isn't working documentation Documentation should be updated

Comments

@k1won
Copy link
Contributor

k1won commented Feb 20, 2022

My actions before raising this issue

Expected Behaviour

The 'dimension' attribute of the /api/projects endpoint (post,patch) should be marked as "readOnly: true" or excluded in the request body schema section.

Current Behaviour

In the api document, the 'dimension' attribute of the /api/projects endpoint (post,patch) is marked as writable.
According to the implementation of the ProjectSerializer class, the 'dimension' field is a read_only field, so I think it should be marked as "readOnly: true" in the api document or excluded from the schema of the request body.
It seems to be due to the characteristic that the read_only_fields Meta option is not referred to in the case of fields explicitly declared in the ModelSerializer.
https://stackoverflow.com/questions/68946823/django-drf-read-only-fields-not-working-properly

Possible Solution

Explicitly add "read_only=True" to the 'dimension' declaration code of the ProjectSerializer class.
After modifying the code in the local development environment, I've checked that the changes are as expected as shown below. (Request and Response)

Steps to Reproduce (for bugs)

  1. check the swagger api document (POST /api/projects)

Context

Your Environment

  • Git hash commit (git log -1): c52c65c
  • Docker version docker version (e.g. Docker 17.0.05):
  • Are you using Docker Swarm or Kubernetes?
  • Operating System and version (e.g. Linux, Windows, MacOS): Ubuntu 18.04
  • Code example or link to GitHub repo or gist to reproduce problem:
  • Other diagnostic information / logs:
    Logs from `cvat` container

Next steps

You may join our Gitter channel for community support.

@nmanovic
Copy link
Contributor

@k1won , thanks for the report. Please let us know if you can send us a PR with the fix.

@nmanovic nmanovic added bug Something isn't working documentation Documentation should be updated labels Feb 21, 2022
@k1won
Copy link
Contributor Author

k1won commented Feb 21, 2022

@k1won , thanks for the report. Please let us know if you can send us a PR with the fix.

@nmanovic , I've already sent a PR to fix this.
thanks.

@k1won k1won closed this as completed Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Documentation should be updated
Projects
None yet
Development

No branches or pull requests

3 participants