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
[Demo][Dashboard] Public create
API
#181950
base: main
Are you sure you want to change the base?
[Demo][Dashboard] Public create
API
#181950
Conversation
create
APIcreate
API
let result: Dashboard; | ||
try { | ||
const cmResult = await client.create(req.body); | ||
result = cmResult.result as unknown as Dashboard; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like there is a gap in the Dashboard
type being passed through so I was getting object
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the problem is data: object
does not let the return type infer the type of the generic to something other than object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But here we are talking about the response right? You might be right but it is strange the the input type affects the output type. Although I've seen weirder things with TS 😄
Summary
A demo showing how with the current code we can get public APIs for dashboards with OpenAPI spec generation.
How to get OAS:
server.oas.enabled: true
tokibana.dev.yml
yarn start --no-base-path
curl -uelastic:changeme http://localhost:5601/api/oas\?pathStartsWith\=/api/dashboard