Conversation
- Fixed references to non-existing files (e.g., files were renamed to remove "input", rWorkflowNotFound.yaml was never added) - Updated processes-workflows to reflect capabilities now included in Part 1 - Core (Version 2) - pExecution: Part 1 now supports collection output - Adding workflow definitions in schemas - The default example has workflows enabled, and this fixes Swagger Editor errors - NOTE: Additional fixes are needed for `swagger-cli validate` and SwaggerUI to work properly
- This fixes "properties members must be schemas" errors in Swagger Editor - Including CWL definition in schemas (fixes swagger-cli bundle issues in Swagger Editor)
- Referencing online JSON Schema is likely not compatible with OpenAPI 3.0 and causing 'swagger-cli validate' to fail. - Including schema.yaml from https://schemas.opengis.net/ogcapi/dggs/1.0/core/schemas/dggs-json/schema.yaml although we could also go back to the version that was removed in aa202c0 - The $comment is causing Swagger validation to fail - Changing top-level CQL2-JSON to be an arbitrary object (couldn't a CQL2 expression be a function returning bool?) -- also args should have been an array - The examples was causing validation to fail - contentEncoding was causing validation to fail - Additional fixes are needed to avoid errors in Swagger Editor / UI
- The use of $defs in CQL2 schema was causing these Swagger Editor errors:
'$ref' value must be an RFC3986-compliant URI reference
(now using cql2defs instead of $defs)
- With this, Swagger Editor now only reports warnings, but Swagger UI still shows 'invalid' with these errors, related to:
- CWL and CQL2 using $schema, $author, $id, $defs, $dynamicAnchors and cql2defs
- DRU pDeploy.yaml and pProcessListDeploy.yaml wrongly directly including the processSummary.yaml schema where a response is expected
(I'll file a separate issue about this -- it should use an response to be added to responses/processes-dru/ if one does not already exist)
{
"messages": [
"attribute components.schemas.CWL.$schema is unexpected",
"attribute components.schemas.CWL.$author is unexpected",
"attribute components.schemas.CWL.$id is unexpected",
"attribute components.schemas.CWL.$defs is unexpected",
"attribute components.schemas.CQL2.$schema is unexpected",
"attribute components.schemas.CQL2.$dynamicAnchor is unexpected",
"attribute components.schemas.CQL2.cql2Defs is unexpected",
"paths.'/processes'(post).responses.201.$ref target #/components/schemas/processSummary is not of expected type Response"
],
"schemaValidationMessages": [
{
"level": "error",
"domain": "validation",
"keyword": "oneOf",
"message": "instance failed to match exactly one schema (matched 0 out of 2)",
"schema": {
"loadingURI": "#",
"pointer": "/definitions/Components/properties/schemas/patternProperties/^[a-zA-Z0-9\\.\\-_]+$"
},
"instance": {
"pointer": "/components/schemas/CQL2"
}
},
{
"level": "error",
"domain": "validation",
"keyword": "oneOf",
"message": "instance failed to match exactly one schema (matched 0 out of 2)",
"schema": {
"loadingURI": "#",
"pointer": "/definitions/Components/properties/schemas/patternProperties/^[a-zA-Z0-9\\.\\-_]+$"
},
"instance": {
"pointer": "/components/schemas/CWL"
}
}
]
}
|
@jerstlouis ogcapi-processes/openapi/paths/processes-dru/pProcessListDeploy.yaml Lines 32 to 40 in 77cec18 Changing them could make deployments relying on them fail since they are different definitions (technically). Is this branch aligned with #547 |
|
@fmigneault That is the schema I used there (from w3id.org), just trying to make it work with OAS 3.0 which did not work. Now although SwaggerUI says valid the schema shows blank so I want to see if something is still wrong. About #547, it doesn't seem to be touching the openapi/ directory which is all I changed. |
56c40c0 to
140368d
Compare
|
@fmigneault Do you know if we've officially given up on OpenAPI 3.0? The OpenAPI definition was previously 3.0 and I was trying to make it work with 3.0... |
140368d to
79a77cc
Compare
|
@jerstlouis both 3.0 and 3.1 are supposed to be supported in this version. There are conformance classes for both. |
|
@pvretano I was referring specifically to the version of the OpenAPI components that we want to provide. Of course implementers can describe their API with OAS 3.0 or 3.1 or even another API definition language... But if we want the components to work with OAS 3.0, then we cannot directly reference JSON Schemas like the CWL and CQL2, hence why I'm trying to embed an OAS 3.0-friendly version of the schemas... Of course we could also offer a 3.1 version of the building blocks which do directly include the online JSON Schemas, but it would be nice if we still have a working 3.0 version. |
|
@fmigneault Would you have any advice on what to replace the conditionals with the CWL schema ? Some of these could be a if:
properties:
type:
const: 'null'
then:
properties:
default:
type: 'null'I really don't understand... If something is specified, why have a default conditional on what it is?! I guess this really cannot be done reasonably well with OAS 3 and shouldn't need to be done anyways so it should just be type:
$ref: '#/components/schemas/AnyType'
default:
$ref: '#/components/schemas/AnyType'? The purpose of the API definition is documentation rather than validation... Or is there already an OAS 3-friendly version of this schema or one close to it somewhere that we could use? |
|
@fmigneault There are things in this official CWL schema ( https://www.commonwl.org/v1.2/cwl-json-schema.yaml ) that I believe are not even valid in JSON Schema e.g.: envValue:
type:
$ref: '#/$defs/CWLExpression'Another error: required:
- expressionLibthis is inside properties but should be outside. |
|
Must be just an indent error. We can patch it. Is that the only errors? I can open the fix PR. |
|
@jerstlouis nullable: true
type: string
enum: [null]This makes it a I've removed the |
|
@fmigneault This is quite frustrating... |
|
@jerstlouis
|
|
@fmigneault I still get an INVALID here: {
"schemaValidationMessages": [
{
"level": "error",
"domain": "validation",
"keyword": "oneOf",
"message": "instance failed to match exactly one schema (matched 0 out of 2)",
"schema": {
"loadingURI": "#",
"pointer": "/definitions/Components/properties/schemas/patternProperties/^[a-zA-Z0-9\\.\\-_]+$"
},
"instance": {
"pointer": "/components/schemas/CWL"
}
}
]
}don't you? Any idea? |
|
Is that even generated by the CWL? There is no @jerstlouis |
5483d11 to
2062d76
Compare
|
@fmigneault I'm using the same old I'm getting closer to the problem: {
"schemaValidationMessages": [
{
"level": "error",
"domain": "validation",
"keyword": "oneOf",
"message": "instance failed to match exactly one schema (matched 0 out of 2)",
"schema": {
"loadingURI": "#",
"pointer": "/definitions/Components/properties/schemas/patternProperties/^[a-zA-Z0-9\\.\\-_]+$"
},
"instance": {
"pointer": "/components/schemas/CWLInputMap"
}
},
{
"level": "error",
"domain": "validation",
"keyword": "oneOf",
"message": "instance failed to match exactly one schema (matched 0 out of 2)",
"schema": {
"loadingURI": "#",
"pointer": "/definitions/Components/properties/schemas/patternProperties/^[a-zA-Z0-9\\.\\-_]+$"
},
"instance": {
"pointer": "/components/schemas/CWLOutputMap"
}
}
]
} |
|
@fmigneault I got it! It was this: --- a/openapi/schemas/cwl/cwl-json-schema.yaml
+++ b/openapi/schemas/cwl/cwl-json-schema.yaml
@@ -1660,8 +1660,8 @@ $defs:
type: object
title: CWLInputMap
description: Package inputs defined as mapping.
- properties: {}
- required: []
+ #properties: {}
+ #required: []
additionalProperties:
oneOf:
- $ref: '#/$defs/CWLType'
(1/2) Stage this hunk [y,n,q,a,d,k,K,j,J,g,/,e,p,P,?]? y
@@ -1739,8 +1739,8 @@ $defs:
type: object
title: CWLOutputMap
description: Package outputs defined as mapping.
- properties: {}
- required: []
+ #properties: {}
+ #required: []
additionalProperties:
oneOf:
- $ref: '#/$defs/CWLType'That was causing those: Seriously these tools are horrible at reporting errors!!! |
536a06e to
662c32e
Compare
- Synced with latest Common - Part 2
662c32e to
2d84fec
Compare
|
@jerstlouis |
|
@fmigneault I think it takes a completely different meaning in OAS 3.0, like there are no properties at all or something. Also I tried taking out the tons of CWL-related schemas from the main example file (so many!!!), but unfortunately when I do that, even though the green "Valid" shows up, when clicking to expand the main schemas it shows a bunch of errors at the top. That is using When using redocly/cil instead, different warnings shows up about rules with different names for format and link, because we have files with the same names for different schemas, and then it renames those... |
|
You should consider dropping |
|
@fmigneault I know, but considering how these tools all produce different results in terms of how things get bundled and how things validate, for the moment I would prefer that we keep testing and things keep working with |
|
@jerstlouis We should also clean up things because there is a |
Warns about being deprecated but it still installs / runs, doesn't it? In OGC API - Coverages, we still have a workflow that automatically runs it and still works I think:
While we can certainly consider that, I am worried about exchanging one set of problems for another (e.g., those same name issues -- redoc/cli doesn't seem to like multiple yaml files with the same file name, even if they are in separate directories). Being focused on redocly, it might also not warn about errors that will then pop up in Swagger Editor/UI. "If it works don't break it", but also "if it works, don't abandon it" ;) We're still using swagger-cli with all the other OGC APIs, and I've just started to use I'm not sure about that top-level openapi.yaml. This one references full absolute paths from raw.github... rather than relative paths. I have been updating/using the |
Does it though? I would be interested also to have actual cross-repo references so we avoid all these local copies that just adds to the problem. |
A large part of the problem is knowing what actually is and isn't a valid definition for OAS 3.0, and for all main tools (e.g. ReDocly and Swagger).
Conceptually, the shared structure that we're using here and in several OGC API repos:
is sort of achieving that, while also giving each repo control over when things are synchronized with the building blocks they are using from other standards...
Cross-repo references suffer from these problems. However, something that might be useful is to have a main repo that assembles everything together and validate and pulls from the different ones. Using git submodules might also be a solution, but ideally we would have repos only for the |
| @@ -1,3 +1,3 @@ | |||
| openapi: 3.0.0 | |||
| info: | |||
| version: '0.1' | |||
There was a problem hiding this comment.
Yes though I think we should avoid 2.0 before the finalized version.
There was a problem hiding this comment.
The 1.0 branch/tag could use that version. Main could at least use 2.0-dev or similar to indicate the intent.
There was a problem hiding this comment.
The official schema says 1.0:
https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/ogcapi-processes-1.yaml
Doesn't seem like we have a release/tag for 1.0:
https://github.com/opengeospatial/ogcapi-processes/tags
2.0-dev or whatever suffix that doesn't imply something "after" 2.0 would be fine.
|
Provided that For cross-repo, it could simply be a recursive |
Perhaps if we tag a specific commit / release and sub-directory that could work. e.g., git archive --remote=https://github.com/opengeospatial/ogcapi-common/ 3dfaa0619907be6a6b0d5ce27a3ea4229c1ec4d1:collections/openapi (archive doesn't seem supported from GitHub, we could do something with but that would require to make sure everything is perfectly synced to use those external repos. (and still requires network access after the clone, but we could have a script to fetch all that, and the the bundling command is local) |
That is exactly the idea. Oh, and regarding the deployment response, I saw on https://github.com/opengeospatial/ogcapi-processes/blob/master/extensions/deploy_replace_undeploy/standard/requirements/deploy-replace-undeploy/deploy/REQ_response-body.adoc, so we cannot have it use |
But this works both ways. If we release OGC API - Processes in a working state, and then the other repository changes (especially if we use the GitHub repo which are dynamic and always reflect the Editor's Draft rather than a specific version), then what used to work stops working (but I guess this clone/copy would only happen while Procsses itself in a draft stage... the released version would not update or directly reference the dependencies) References to a moving target are more problematic, but we can have either an automatic action or a manual process to regularly update all references to external repo on a regular basis. There are also timing issues, where in a certain stage of development / release freeze cycle you might not want to update anything that is being changed elsewhere. About There's a grammar issue right now with that, and yes the processDescription still is valid with that requirement. But we can define a new response for it specifically, especially if the inputs / outputs (descriptions, right?) never make sense to include. But actually I am questioning that? |

This PR contains several fixes in an initial attempt to fix the OpenAPI example definitions ( #401 and #390 ).
Please review the individual commits, with the earlier commits potentially easier to merge.
See also the obvious
propretiestypo that I pushed directly (77cec18).At different commits along this Pull Request:
swagger-cli bundleworks againswagger-cli validateworks againEDIT: Swagger UI now says
valid.(EDIT: It actually did not after properly including the CWL schema, but now it does!)
This also includes a fix for #562.
OAS does not allow using $defs in the final schemas being used in the bundle, so embedding in the repo the CWL and CQL2 schemas allors to tweak that.
Note that that this PR (in the later commits) embeds a local version of the CQL2 schema, CWL schema and a simplified JSON (meta)Schema to get this all to work. If we also embed the GeoJSON schemas (I have this in a separate branch that I did not push), then the bundling is a lot faster and it could be done in a CI/CD without network access.
Also note that we should still review any differences remaining between the files in: schemas/processes-workflows vs. schemas/processes-core.
cc. @pvretano @bpross-52n @fmigneault @gfenoy
Note that I've changed some references to CWLschema at:
https://raw.githubusercontent.com/common-workflow-lab/cwl-ts-auto/main/json_schemas/cwl_schema.yaml
to the w3id.org one which fixes this error in Swagger Editor:
because it does:
(I don't know if this is supposed to be valid somehow...)
(and now the schema is actually copied to the repo and tweaked to fix the errors)