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

Cannot add or update project metadata by calling the swagger API directly #20120

Closed
zyyw opened this issue Mar 13, 2024 · 0 comments
Closed

Cannot add or update project metadata by calling the swagger API directly #20120

zyyw opened this issue Mar 13, 2024 · 0 comments

Comments

@zyyw
Copy link
Contributor

zyyw commented Mar 13, 2024

If you are reporting a problem, please make sure the following information are provided:
Installing harbor oss v2.9.3, calling Harbor swagger API as below to update project metadata is failing:
request:

PUT /api/v2.0/projects/<project_id>/metadatas/public

payload:

{
    "public": "true"
}

Actual HTTP return message(it's an error):

{
    "errors": [
        {
            "code": "BAD_REQUEST",
            "message": "invalid key: "
        }
    ]
}

It also failed for adding a project metadata via POST:
request:

POST /projects/{project_name_or_id}/metadatas/

payload:

// some valid payload here

Actual HTTP return message (it's an error):

{
    "errors": [
        {
            "code": "BAD_REQUEST",
            "message": "invalid key: "
        }
    ]
}

Expected behavior and actual behavior:
The PUT request to update a project metadata and POST request to add a project metadata should working fine, instead of returning BAD_REQUEST.

Steps to reproduce the problem:
Install harbor v2.9.3, calling Harbor swagger API using curl/postman to send PUT or POST request, it will response with a BAD_REQUEST.

Versions:
Please specify the versions of following systems.

  • harbor version: [v2.9.3] - v2.8.5 also has this issue
  • docker engine version: [y.y.y]
  • docker-compose version: [z.z.z]

Additional context:
This issue is due to this change in v2.9.3, and this change in v2.8.5.
This issue should be fixed in Harbor v2.9.4 and v2.8.6 (if there is a v2.8.6 patch release)
Workaround: using Harbor portal to configure your project metadata settings, instead of directly calling the Harbor swagger API to add or update project metadata.

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