-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
On some APIs there are global parameters which are applied on every API request i.e. the Notion API has a Notion-Version
header which is required for every request s.
Currently we can only add an argument for each operation where we provide this header value. It would be better if we could globally configure this header value and automatically add this to every operation. We could add some sort of traits
where we define arguments and then use those traits at every operation s.
{
"traits": {
"version": {
"Notion-Version": {
"in": "header",
"schema": {
"type": "string"
}
}
}
},
"operations": {
"getMessage": {
"description": "Returns a hello world message",
"method": "GET",
"path": "/hello/world",
"traits": ["version"],
"return": {
"schema": {
"$ref": "Hello_World"
}
}
}
},
"definitions": {
"Hello_World": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
}
}
}
const client = new Client()
client.setVersion("2022-06-28");
client.getMessage(): HelloWorld
This should then include the version header for the getMessage
call.
Metadata
Metadata
Assignees
Labels
No labels