-
Notifications
You must be signed in to change notification settings - Fork 314
Closed
Labels
bugSomething isn't workingSomething isn't workingdocsImprovements or additions to documentationImprovements or additions to documentationlib:versioningtriaged:core
Milestone
Description
Describe the bug
I'm revising the pet store example and encountered a cryptic error when I forgot to consistently use the '@added' decorator to specify versioning in operations added for the toy resource.
This code uses two instances of the @added
decorator:
// Operations under the 'toys' namespace are only available in v2 of the API
@route("{petId}/toys/{toyId}")
namespace Toys {
@added(Versions.v2)
@get
op getToy(@path petId: int32, @path toyId: int32): OkResponse & {
@body toy: Toy;
} | NotFoundResponse & {
@body error: NotFoundError;
};
@added(Versions.v2)
@useAuth(BearerAuth)
@put
op updateToy(@path petId: int32, @path toyId: int32, @body toy: Toy): OkResponse & {
@body updatedToy: Toy;
} | NotFoundResponse & {
@body error: NotFoundError;
};
}
If I remove the second @added
decorator, I get the following error, which doesn't help me determine what the issue is:
error @typespec/openapi3/invalid-schema Couldn't get schema for type never <unknown location>:1:1
Can the error checking be improved to correctly identify the cause?
Reproduction
playground link to working case
Checklist
- Follow our Code of Conduct
- Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdocsImprovements or additions to documentationImprovements or additions to documentationlib:versioningtriaged:core