Skip to content

enhance: automatically use the generic credential tool for OpenAPI #488

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

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

g-linville
Copy link
Member

@g-linville g-linville commented Jun 12, 2024

This is a relatively simple change that just adds a Credential: line or two to each tool generated for an OpenAPI definition, if there is some supported security scheme for the particular operation (i.e. API key, HTTP bearer token, HTTP basic auth).

This works seamlessly with existing OpenAPI tool examples such as the DigitalOcean agent.

Comment on lines +414 to +416
for _, cred := range t.Parameters.Credentials {
_, _ = fmt.Fprintf(buf, "Credential: %s\n", cred)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

We were previously printing the credential tools all on one line, which is no longer supported. This change makes it print each on its own line, which is supported.

@g-linville g-linville marked this pull request as ready for review June 12, 2024 19:41
Signed-off-by: Grant Linville <[email protected]>
@g-linville g-linville merged commit 721d518 into gptscript-ai:main Jun 14, 2024
2 checks passed
@g-linville g-linville deleted the openapi-cred-tool-generation branch June 14, 2024 15:16
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 this pull request may close these issues.

3 participants