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

Re generate cadl ranch tests #8

Open
wants to merge 1 commit into
base: improve-static-file-handling
Choose a base branch
from

Conversation

joheredi
Copy link
Owner

Splitting this into its own PR to help reviewing

Copy link

@dgetu dgetu left a comment

Choose a reason for hiding this comment

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

:shipit:

Comment on lines +4 to +6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

Copy link

Choose a reason for hiding this comment

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

why is this duplicated?

Comment on lines -185 to +287
if (isUnexpected(response)) {
throw createRestError(
`Pagination failed with unexpected statusCode ${response.status}`,
response,
);
const statusCode = Number(response.status);
if (statusCode < 200 || statusCode >= 300) {
if (statusCode >= 400 && statusCode < 500) {
throw createRestError(
`Pagination failed with client error statusCode ${response.status}`,
response,
);
} else if (statusCode >= 500) {
throw createRestError(
`Pagination failed with server error statusCode ${response.status}`,
response,
);
} else {
throw createRestError(
`Pagination failed with unexpected statusCode ${response.status}`,
response,
);
}
Copy link

Choose a reason for hiding this comment

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

not quite sure why we remove isUnexpected helper ?

Copy link

Choose a reason for hiding this comment

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

is it part of the removing rlc types change?

@@ -1,20 +1,105 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
Copy link

Choose a reason for hiding this comment

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

If I remember correctly, not everything is static in paging helpers, for example

Copy link

Choose a reason for hiding this comment

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

this nextlinkname option should be fixed in paging helper but could be configed differently in places called this helper -

PagedAsyncIterableIterator,
} from "./models/index.js";
export { User, ListOptionalParams } from "./models/index.js";
export { PageSettings, ContinuablePage, PagedAsyncIterableIterator };
Copy link

Choose a reason for hiding this comment

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

Just curious, why we import first and then export them instead of export them directly?

Comment on lines -184 to -195
const Http2xxStatusCodes = [
"200",
"201",
"202",
"203",
"204",
"205",
"206",
"207",
"208",
"226",
];
Copy link

Choose a reason for hiding this comment

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

I wonder if that means we have supported range status Azure#2063 @MaryGao ?

Copy link

Choose a reason for hiding this comment

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

The issue you linked is not the same thing as this range, 2063 one is talking about supporting status range from typespec. But this helper is deviring from the logic in HLC: https://github.com/Azure/autorest.typescript/blob/main/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/src/account/paginateHelper.ts#L135

Copy link

Choose a reason for hiding this comment

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

yeah, I wonder if that could cause some problem since we are expanding the valid response status code for 2xx?

Copy link

Choose a reason for hiding this comment

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

I would say that could be a pontential issue but I am not worried about this. The above logic is used in HLC for a long time to check if the response is okay or not, and it works well.

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.

4 participants