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

id missing in the payload for the endpoint POST /accounts #2982

Open
MBhartiya opened this issue Apr 15, 2022 · 7 comments
Open

id missing in the payload for the endpoint POST /accounts #2982

MBhartiya opened this issue Apr 15, 2022 · 7 comments
Labels
bug protocol stale For marking issues as stale. Labeled issues will be closed soon if label is not removed.

Comments

@MBhartiya
Copy link

In the response for GET /_api_,

for the endpoint POST /accounts, the ObjectSchema( body) is
Screenshot 2022-04-15 at 2 07 07 PM

Using this body gives the following error,

{
    "code": 400,
    "errno": 107,
    "error": "Invalid parameters",
    "message": "data.id in body: Required",
    "details": [
        {
            "location": "body",
            "name": "data.id",
            "description": "data.id in body: Required"
        }
    ]
}

The "id" field is missing in the body of the endpoint POST /accounts in the OpenAPI Spec.
Correct payload should be,

{
    "data": {
        "password": "string",
        "id": "username",
        "additionalProp1": "string",
        "additionalProp2": "string",
        "additionalProp3": "string"
    },
    "permissions": {
        "read": [
            "string"
        ],
        "write": [
            "string"
        ]
    }
}
@DHClimber
Copy link

Hi, I would like to take a look at this issue.

@Natim
Copy link
Member

Natim commented Sep 18, 2023

Please feel free to go ahead!

@Natim
Copy link
Member

Natim commented Sep 18, 2023

Maybe should we actually remove the POST and turn it into a PUT because requiring an id on POST seems a bit odd to me.

@DHClimber
Copy link

Screenshot 2023-09-18 at 1 55 43 PM I managed to recreate and get correct response. Now trying to understand source code.

@DHClimber
Copy link

Maybe should we actually remove the POST and turn it into a PUT because requiring an id on POST seems a bit odd to me.

Hi Natim, I'm very new and struggling to find where this is specified in the code. Any suggestions to point me in the right direction?

@DHClimber
Copy link

I've been looking at this for a while, and I'm struggling to find how to access the OpenAPI Spec. Any tips is much appreciated.

@Natim
Copy link
Member

Natim commented Sep 19, 2023

You mean for the error message?

https://github.com/Kinto/kinto/blob/master/kinto/plugins/accounts/views/__init__.py#L28-L39

It is then used here: https://github.com/Kinto/kinto/blob/master/kinto/plugins/accounts/views/__init__.py#L85

Reading the code I think we don't want to fix this bug actually. Because it is an edge case of the admin privileges.

The OpenAPI is build automatically from the resource using the OpenAPI module

@alexcottner alexcottner added the stale For marking issues as stale. Labeled issues will be closed soon if label is not removed. label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug protocol stale For marking issues as stale. Labeled issues will be closed soon if label is not removed.
Projects
None yet
Development

No branches or pull requests

5 participants