Issue #8715

Updated by pulpbot about 2 years ago


 **Ticket moved to GitHub**: "pulp/pulpcore/1991": 


 For example: 


 gets transformed to 


 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 
 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=< 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=< object at 0x7f5a4e729f28> 
  pulpcore.openapi __init__.convert_endpoint_path_params:345     165 - view=< 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