Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to define the parameter schema #21

Closed
jamesfisher-geo opened this issue Sep 28, 2023 · 1 comment · Fixed by #31
Closed

How to define the parameter schema #21

jamesfisher-geo opened this issue Sep 28, 2023 · 1 comment · Fixed by #31

Comments

@jamesfisher-geo
Copy link
Collaborator

jamesfisher-geo commented Sep 28, 2023

PR #20 added a parameter object, which is used to describe parameters for any authorization request using in, required, description, and schema fields. This aligns with the OpenAPI spec for [describing parameters]{https://swagger.io/docs/specification/describing-parameters/). For example, one could define the authorization request to Planetary Computer with the following:

"auth:schemes": {
    "plantetary_computer_auth": {
        "type": "signedUrl",
        "description": "Requires authorization from Planetary Computer",
        "flows": {
            "authorizationCode": {
                "authorizationApi": "https://planetarycomputer.microsoft.com/api/sas/v1/sign",
                "method": "GET",
                "parameters": {
                    "href": {
                        "in": "query",
                        "required": true,
                        "description": "HREF (URL) to sign",
                        "schema": {
                            "type": "string",
                        }
                    },
                    "duration": {
                        "in": "query",
                        "required": false,
                        "description": "The duration, in minutes, that the SAS token will be valid. Only valid for approved users.",
                        "schema": {
                            "type": "integer",
                        }
                    },
                    "_id": {
                        "in": "query",
                        "required": false,
                        "description": "Third party user identifier for metrics tracking.",
                        "schema": {
                            "type": "string"
                        }
                    }
                },
                "responseField": "href"
            }
        }
    }
}

My issue is that the schema field is currently defined as an optional object in the json schema. Replicating full support for Open API data models would be out of scope for this extension. But keeping the schema parameter how it is does not impose any standards on parameter schema definitions.

Perhaps a lightweight parameterSchema object is a good middle ground. The parameterSchema object could include the following fields:

  • type
  • format
  • example
  • minimum
  • maximum
  • pattern

Open to comments/suggestions

@m-mohr
Copy link
Contributor

m-mohr commented Apr 27, 2024

Maybe just link to the JSON Schema draft-07 metaschema using a $ref?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants