Project

Profile

Help

Issue #3851

Bindings require endpoint href instead of resource href

Added by daviddavis almost 2 years ago. Updated about 2 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
API Bindings, Katello
Sprint:
Sprint 42

Description

We patched the bindings so that if there are any path variables in the url (e.g. /repositories/<repo_pk>/versions/<number>/content/) you have to instead pass in the entire href you want to call. Here's an example:

from swagger_client.api.repositories_api import RepositoriesApi
api = RepositoriesApi()
api.repositories_versions_content("/repositories/1/versions/1/content/")

Notice how I have to construct the href I am calling. Here's how I would expect the bindings to work:

from swagger_client.api.repositories_api import RepositoriesApi
api = RepositoriesApi()
api.repositories_versions_content("/repositories/1/versions/1/")

Notice that I am using the repo version href and not the endpoint that the bindings are actually calling.

Associated revisions

Revision b9399bcd View on GitHub
Added by dkliban@redhat.com almost 2 years ago

Problem: OpenAPI schema doesn't use URIs to identify resources

Solution: Create a custom OpenAPI generator that refers to resources by their URI.

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

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

Revision b9399bcd View on GitHub
Added by dkliban@redhat.com almost 2 years ago

Problem: OpenAPI schema doesn't use URIs to identify resources

Solution: Create a custom OpenAPI generator that refers to resources by their URI.

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

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

History

#1 Updated by CodeHeeler almost 2 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 40

#2 Updated by daviddavis almost 2 years ago

  • Sprint/Milestone set to 3.0.0

#3 Updated by daviddavis almost 2 years ago

  • Tags API Bindings added

#4 Updated by jsherril@redhat.com almost 2 years ago

  • Tags Katello-P1 added

#5 Updated by bmbouter almost 2 years ago

I'll try to answer the question in the ticket about how the user will get that href. The user was given that string when the repo version was created. Then they use it with the bindings to make an object they can interact with.

Also this is consistent with how all bindings work, even those that have IDs. If an object had id 123456, the user would have had to receive 123456 from a server response at some point. Only by saving that response can they have the ID 123456 to use with the bindings to make an object they can interact with. So the decision of a url isn't creating or solving any problems specifically.

I want to state the value in the bindings as I see them to see what others think. I believe the value of the bindings is in their language-native usefulness after they are instantiated. What string you hand them to instantiate the objects I don't think affects that value.

I believe the right resolution is to close as NOTABUG. If it does stay on the sprint, I believe it needs to go through sprint planning again because it's not clear what the expected resolution is.

#6 Updated by daviddavis almost 2 years ago

bmbouter, thanks for the response. I think the bug is unclear so let me give an illustration that might help clarify this bug. Here's how you call the repo version method in the bindings today:

api.repositories_versions_content("/repositories/1/versions/1/content/")

Notice that I have to supply the url to the endpoint including /content/ component.

What I would expect is that I be able to call the function with the repo version identifier or href:

api.repositories_versions_content("/repositories/1/versions/1/")

In other words, currently you have to supply the href to the endpoint you are calling instead of the href to the resource you are interacting with (e.g. repo version).

Let me know if that's still not clear. I'll update the bug title and description.

#7 Updated by daviddavis almost 2 years ago

  • Subject changed from The bindings require users to know the href they are calling to Bindings require endpoint href instead of resource href
  • Description updated (diff)

#8 Updated by dkliban@redhat.com almost 2 years ago

This is a bug with how the bindings are currently being generated. Thank you for explaining it @daviddavis. There are 2 ways to resolve this issue: update swagger-codegen or update our OpenAPI schema to work with upstream swagger-codegen. I've started a discussion about this on the list[0]. bmbouter please provide feedback on the list also.

[0] https://www.redhat.com/archives/pulp-dev/2018-July/msg00071.html

#9 Updated by rchan almost 2 years ago

  • Sprint changed from Sprint 40 to Sprint 41

#10 Updated by dkliban@redhat.com almost 2 years ago

  • Status changed from NEW to POST
  • Assignee set to dkliban@redhat.com

#11 Updated by rchan almost 2 years ago

  • Sprint changed from Sprint 41 to Sprint 42

#12 Updated by dkliban@redhat.com almost 2 years ago

  • Status changed from POST to MODIFIED

#13 Updated by bmbouter about 1 year ago

  • Tags deleted (Pulp 3)

#14 Updated by bmbouter 7 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

#15 Updated by ggainey about 2 months ago

  • Tags Katello added
  • Tags deleted (Katello-P1)

Please register to edit this issue

Also available in: Atom PDF