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

Schema does not contain information about all parameters #61

Open
C-Otto opened this issue May 8, 2019 · 9 comments
Open

Schema does not contain information about all parameters #61

C-Otto opened this issue May 8, 2019 · 9 comments

Comments

@C-Otto
Copy link

C-Otto commented May 8, 2019

In LinkCreator.createFor (line 133) the schema is only generated for the last resource on the path, information from previous resources is ignored.

@wuan
Copy link
Collaborator

wuan commented May 8, 2019

Not sure if I understand your question correctly. If you have subresources, you have to give the full chain of resources so that the generator is able to create the path correctly. The method for which the link is created has to be on the last resource.

@C-Otto
Copy link
Author

C-Otto commented May 8, 2019

The path is generated correctly, but the schema is not. The full chain is given, but only the last segment of it is used at the code I mentioned.

@wuan
Copy link
Collaborator

wuan commented May 9, 2019

Do you have an example of a case where this is wrong. Is it the case where a subresource method is not allowed and this is not considered here or do you miss query or path parameters from one of the subresource methods before?

@C-Otto
Copy link
Author

C-Otto commented May 10, 2019

I have one back at Mercateo, I will show you on Monday if you're interested. We had the issue with a path /api/shops/{shop id}/something/{something id}. In the schema only the {something id} was documented, but not {shop id}.

There is a resource for /api/shops/, and another resource for /api/shops/{shop id}/something/.

What I miss is the schema information for {shop id}. The path is correct. I fail do understand how to make this clearer, the very first word of this issue is "schema" after all.

@wuan
Copy link
Collaborator

wuan commented May 10, 2019

So your path parameter shop_id should be also contained in the input and/or output schema objects of the endpoint as well? Then it is not only a path parameter, but some kind of redundancy in the payload as well. This can be achieved by using an allowed value object (aka ENUM) with the shop_id being set to the desired value.

@JoergAdler
Copy link
Collaborator

When i get it right he want's to have a template link with the parameter not set.

@wuan
Copy link
Collaborator

wuan commented May 10, 2019

Then lets better base this on an example or a failing test.

@C-Otto
Copy link
Author

C-Otto commented May 13, 2019

imgpsh_mobile_save

This is the result created using the library. As you can see the schema contains the last path variable {id}, but not the one before {app-id}.

This issue is caused by the code line I mentioned above.

Does that help?

@Busoniu
Copy link
Contributor

Busoniu commented Jun 9, 2020

The problem is that in the method addSchemaIfNeeded only the lastScopedMethod is used:

addSchemaIfNeeded(builder, lastScopedMethod, linkFactoryContext);

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

No branches or pull requests

4 participants