Project

Profile

Help

Issue #8715

Updated by pulpbot about 2 years ago

 

 **Ticket moved to GitHub**: "pulp/pulpcore/1991":https://github.com/pulp/pulpcore/issues/1991 




 ---- 


 For example: 

 `/api/automation-hub/v3/namespaces/{name}/`  

 gets transformed to 

 `{galaxy_namespace_href}` 

 This happens for any urls with a path param unless they bound to 'list' or 'create' actions. 
 ie, except for POST and GET list'y things, all the endpoint urls in the generated spec 
 get replaced. 

 I think the reason why the generated openapi schema is so weird and wrong (like for the spec generated for galaxy namespaces mentioned in https://issues.redhat.com/browse/AAH-450). 
 If a url path has _any_ path param in it, `pulpcore.openapi.PulpSchemaGenerator.convert_endpoint_path_params()`    replaces it with some variation of `{blah_href}`.   

 For ex, `GET /api/automation-hub/v3/namespaces/{name}/` is mogrified into `GET {galaxy_namespace_href}`.    But 'list' and 'create' actions dont get modified 

 So except for 'list' and 'create' actions all of the galaxy_ng endpoint urls in the spec are broken. For galaxy_ng, this can be confirmed by looking at `/api/automation-hub/v3/swagger-ui/` 

 Some output from logging the spec generation for the `/api/automation-hub/v3/namespaces/` endpoints: 

 ~~~ 
  pulpcore.openapi __init__.parse:381     165 - path=/api/automation-hub/v3/namespaces/ 
  pulpcore.openapi __init__.parse:382     165 - path_regex=api/automation-hub/v3/^namespaces/$ 
  pulpcore.openapi __init__.parse:383     165 - method=POST 
  pulpcore.openapi __init__.parse:384     165 - view=<galaxy_ng.app.api.v3.viewsets.namespace.NamespaceViewSet object at 0x7f5a4e729ef0> 
  pulpcore.openapi __init__.parse:396     165 - path2=/api/automation-hub/v3/namespaces/ 
 ^ -- path not munged for a POST / 'create' 

  pulpcore.openapi __init__.parse:400     165 - operation={'operationId': 'api_automation_hub_v3_namespaces_create', 'description': 'Override to validate for name duplication before serializer validation.', 'summary': 'Create a namespace', 'tags': ['Api: Automation-Hub Namespaces'], 'requestBody': {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/Namespace'}}, 'application/x-www-form-urlencoded': {'schema': {'$ref': '#/components/schemas/Namespace'}}, 'multipart/form-data': {'schema': {'$ref': '#/components/schemas/Namespace'}}}, 'required': True}, 'security': [{'cookieAuth': []}, {'tokenAuth': []}], 'responses': {'201': {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/NamespaceResponse'}}}, 'description': ''}}} 
  pulpcore.openapi __init__.parse:401     165 - schema.method=POST 

  pulpcore.openapi __init__.parse:381     165 - path=/api/automation-hub/v3/namespaces/{name}/ 
  pulpcore.openapi __init__.parse:382     165 - path_regex=api/automation-hub/v3/^namespaces/(?P<name>[^/.]+)/$ 
  pulpcore.openapi __init__.parse:383     165 - method=GET 
  pulpcore.openapi __init__.parse:384     165 - view=<galaxy_ng.app.api.v3.viewsets.namespace.NamespaceViewSet object at 0x7f5a4e729f28> 
  pulpcore.openapi __init__.convert_endpoint_path_params:345     165 - view=<galaxy_ng.app.api.v3.viewsets.namespace.NamespaceViewSet object at 0x7f5a4e729f28>, parent_viewset=None 
  pulpcore.openapi __init__.parse:396     165 - path2={galaxy_namespace_href} 
  ^ -- path is munged for a GET /    'retrieve' 

  pulpcore.openapi __init__.parse:400     165 - operation={'operationId': 'namespace_instance_read', 'description': '', 'summary': 'Inspect a namespace', 'parameters': [{'in': 'path', 'name': 'galaxy_namespace_href', 'schema': {'type': 'string'}, 'required': True}], 'tags': ['Namespace: Instance'], 'security': [{'cookieAuth': []}, {'tokenAuth': []}], 'responses': {'200': {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/NamespaceResponse'}}}, 'description': ''}}} 
  pulpcore.openapi __init__.parse:401     165 - schema.method=GET 
 ~~~ 

 

Back