Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Changes:

Fixes:
------
- Fix rendering of `OpenAPI` definitions for ``POST /processes`` deployment such that each indicated ``Content-Type``
correctly provides its corresponding examples for `OGC Application Package` and `CWL` representations in YAML/JSON.
- Fix the `CLI` documentation about the reported result from ``undeploy`` command. It referred to a missing JSON
response file, which is not valid since ``HTTP 204 No Content`` is returned for that successful operation.
- Adjusted OpenAPI `Job` result examples with by-value/href responses.
Expand Down
2 changes: 1 addition & 1 deletion weaver/processes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ def deploy_process_from_payload(payload, container, overwrite=False): # pylint:
request=container if hasattr(container, 'body') else None,
content=payload,
content_type=c_type_full, # Pass full Content-Type with parameters (e.g., boundary)
content_type_schema=sd.DeployContentType,
content_type_schema=sd.DeployContentTypeAny,
)

# Extract process ID from Content-ID header if provided (RFC 2392)
Expand Down
11 changes: 8 additions & 3 deletions weaver/wps_restapi/processes/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,21 @@ def get_processes(request):

@sd.processes_service.post(
tags=[sd.TAG_PROCESSES, sd.TAG_DEPLOY],
schema=sd.PostProcessesEndpointCWLYAML(),
schema=sd.PostProcessesEndpointCWL(),
accept=ContentType.APP_JSON,
content_type=[ContentType.APP_CWL_YAML, ContentType.APP_CWL, ContentType.APP_CWL_X],
content_type=[
ctype for ctype in
sd.DeployContentTypeCWL.validator.choices
if ctype not in sd.DeployContentTypeOGC.validator.choices
],
renderer=OutputFormat.JSON,
response_schemas=sd.post_processes_responses,
)
@sd.processes_service.post(
tags=[sd.TAG_PROCESSES, sd.TAG_DEPLOY],
schema=sd.PostProcessesEndpoint(),
schema=sd.PostProcessesEndpointOGC(),
accept=ContentType.APP_JSON,
content_type=sd.DeployContentTypeOGC.validator.choices,
renderer=OutputFormat.JSON,
response_schemas=sd.post_processes_responses,
)
Expand Down
75 changes: 62 additions & 13 deletions weaver/wps_restapi/swagger_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7558,7 +7558,7 @@ class Deploy(OneOfKeywordSchema):
]


class DeployContentType(ContentTypeHeader):
class DeployContentTypeAny(ContentTypeHeader):
example = ContentType.APP_JSON
default = ContentType.APP_JSON
validator = OneOf([
Expand All @@ -7573,19 +7573,52 @@ class DeployContentType(ContentTypeHeader):
])


class DeployHeaders(RequestHeadersBody):
class DeployContentTypeOGC(ContentTypeHeader):
example = ContentType.APP_JSON
default = ContentType.APP_JSON
validator = OneOf([
ContentType.APP_JSON,
ContentType.APP_OGC_PKG_JSON,
ContentType.APP_OGC_PKG_YAML,
ContentType.APP_YAML,
])


class DeployContentTypeCWL(ContentTypeHeader):
example = ContentType.APP_JSON
default = ContentType.APP_JSON
validator = OneOf([
ContentType.APP_CWL,
ContentType.APP_CWL_JSON,
ContentType.APP_CWL_YAML,
ContentType.APP_CWL_X,
ContentType.APP_YAML,
ContentType.APP_JSON,
Comment on lines +7595 to +7596

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this be already covered with

ContentType.APP_CWL_JSON,
ContentType.APP_CWL_YAML,

Why do we need those two

])


class DeployHeadersAny(RequestHeadersBody):
x_auth_docker = XAuthDockerHeader()
content_type = DeployContentTypeAny()


class DeployHeadersOGC(RequestHeadersBody):
x_auth_docker = XAuthDockerHeader()
content_type = DeployContentTypeOGC()


class DeployHeadersCWL(RequestHeadersBody):
x_auth_docker = XAuthDockerHeader()
content_type = DeployContentType()
content_type = DeployContentTypeCWL()


class PostProcessesEndpoint(ExtendedMappingSchema):
header = DeployHeaders(description="Headers employed for process deployment.")
header = DeployHeadersAny(description="Headers employed for process deployment.")
querystring = FormatQuery()
body = Deploy(title="Deploy", examples={
"DeployCWL": {
"summary": "Deploy a process from a CWL+JSON definition.",
"value": EXAMPLES["deploy_process_cwl.json"],
},


class DeployBodyOGC(Deploy):
examples = {
"DeployOGC": {
"summary": "Deploy a process from an OGC Application Package definition.",
"value": EXAMPLES["deploy_process_ogcapppkg.json"],
Expand All @@ -7594,16 +7627,32 @@ class PostProcessesEndpoint(ExtendedMappingSchema):
"summary": "Deploy a process from a remote WPS-1 reference URL.",
"value": EXAMPLES["deploy_process_wps1.json"],
}
})
}


class PostProcessesEndpointCWLYAML(PostProcessesEndpoint):
body = PermissiveMappingSchema(title="DeployCWLYAML", examples={
class DeployBodyCWL(Deploy):
examples = {
"DeployCWLJSON": {
"summary": "Deploy a process from a CWL+JSON definition.",
"value": EXAMPLES["deploy_process_cwl.json"],
},
"DeployCWLYAML": {
"summary": "Deploy a process from a CWL+YAML definition.",
"value": EXAMPLES["deploy_process_yaml.cwl"],
},
})
}


class PostProcessesEndpointOGC(PostProcessesEndpoint):
header = DeployHeadersOGC(description="Headers employed for process deployment.")
querystring = FormatQuery()
body = DeployBodyOGC()


class PostProcessesEndpointCWL(PostProcessesEndpoint):
header = DeployHeadersCWL(description="Headers employed for process deployment.")
querystring = FormatQuery()
body = DeployBodyCWL()
Comment on lines +7647 to +7655

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description could reflect if its CWL or OGC headers for more context



class UpdateInputOutputBase(DescriptionType, InputOutputDescriptionMeta):
Expand Down
Loading