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

Setting Description #767

Closed
ingalls opened this issue Feb 20, 2024 · 1 comment
Closed

Setting Description #767

ingalls opened this issue Feb 20, 2024 · 1 comment

Comments

@ingalls
Copy link

ingalls commented Feb 20, 2024

Context

I am switching from AJV/JSON Schema files to TypeBox via a custom middleware around express. The Middleware also generates OpenAPI definitions for every route it manages. Ref: https://github.com/openaddresses/batch-schema

As part of the generation it would use the description field from the JSON Schema to populate human readable parameters/queries/bodies in the OpenAPI definition. Now that I've switched to using typebox in place of the schema it's been working perfectly expcept for the loss of the ability to set the description field on typebox defined types.

I've searched the code and readme and I'm not seeing an ability to do something like below.

Type.Object{
    username: Type.String({ "description": "The username of the user")
}, {
    "description": "An object containing user information"
})

Would generate

{
    "type": "object",
    "description": "An object containing user information",
    "required": ["username"],
    "properties": {
        "username": {
            "type": "string",
            "description": "An object containing user information"
        }
    }
}

If this doesn't exist would it be something the community would find useful and if it does would folks be able to point me in the right direction of a code sample.

cc @sinclairzx81

@ingalls
Copy link
Author

ingalls commented Feb 21, 2024

Playing around with the workbench it seems like this already exists just doesn't have an example in the documentation.

@ingalls ingalls closed this as completed Feb 21, 2024
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

No branches or pull requests

1 participant