Azure / Azure/typespec-azure

[Bug]: RequestParameter do not allow to link to non-body parameter

Open
#1,880 0 comments 0 reactions 0 assignees View on GitHub
bug lib:azure-core
Dominant language
TypeScript
Stars
27
Forks
90
Avg merge
1d 22h
Merged PRs (30d)
156

Description

### Describe the bug

This TypeSpec:
```tsp
interface Foo {
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is a test."
@route("{nextLink}")
@get nextPage is Azure.Core.Foundations.Operation<
{ @query foo?: string, nextLink: string },
Azure.Core.Page
>;

@nextPageOperation(Foo.nextPage,
{
nextLink: ResponseProperty<"nextLink">,
foo: RequestParameter<"foo">
})
list is Azure.Core.ResourceList;
}
```

End up with an error `Request parameter 'foo' not found on request body model`

Discussed with @markcowl that we should be able to link non-body parameter as well

### Reproduction

See above

### Checklist

- [x] Follow our [Code of Conduct](https://github.com/azure/typespec-azure/blob/main/CODE_OF_CONDUCT.md)
- [x] Check that this issue is about the Azure libraries for typespec. For bug in the typespec language or core libraries file it in the [TypeSpec repo](https://github.com/Microsoft/TypeSpec/issues/new/choose)
- [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.

Contributor guide

Open the contributing guide

Research direction

Start by searching the repository for the error text "Request parameter 'foo' not found on request body model" and the RequestParameter handling used by @nextPageOperation. Use the provided TypeSpec reproduction to verify the failure, then add coverage showing that a non-body request parameter can be linked and confirm the error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.