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

Renames & Refactorings #9266

Merged
merged 13 commits into from
Jun 3, 2020
Merged

Renames & Refactorings #9266

merged 13 commits into from
Jun 3, 2020

Conversation

sarangan12
Copy link
Member

This PR consists of code changes for the following tasks:

  1. Search model renames - Search model renames #8984
  2. More Search renames - More Search renames #9037
  3. Search: Proposed model and property renames - Search: Proposed model and property renames #8383
  4. Rename "DataSource" methods on SearchIndexerClient to "DataSourceConnection" - Rename "DataSource" methods on SearchIndexerClient to "DataSourceConnection" #9166
  5. Non optional parameters should be moved out of the option bag - Non optional parameters should be moved out of the option bag #9238
  6. Change countDocuments to getDocumentsCount - Change countDocuments to getDocumentsCount #9240
  7. Pull searchText from optionBag to method parameter - Pull searchText from optionBag to method parameter #9241
  8. In indexDocuments method rename options parameter - In indexDocuments method rename options parameter #9244

@xirzec Please review and approve

@ramya-rao-a FYI.....

Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

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

Overall I think this PR is good; there are just a few things that I noticed.

@@ -107,7 +108,7 @@ export interface SearchRequest {
orderBy?: string;
/**
* A value that specifies the syntax of the search query. The default is 'simple'. Use 'full' if
* your query uses the Lucene query syntax. Possible values include: 'simple', 'full'
* your query uses the Lucene query syntax. Possible values include: 'Simple', 'Full'
Copy link
Member

Choose a reason for hiding this comment

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

it still feels like a codegen bug that the possible list is capitalized. If a user passes in 'Simple' instead of 'simple', would it still work? (I know TS might complain, but what happens if they're just using JS?)

/cc @joheredi

Copy link
Member Author

Choose a reason for hiding this comment

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

TS will complain. JS will allow it

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for bringing this up Jeff, yes this is definitely a bug in Autorest.Typescriopt (v5). @sarangan12 do you know if the swagger changed here. Or were you fixing this by hand previously?

I can't find a recent change in Autorest.Typescript that may have regressed this. Anyway, I'll file a bug and make sure this is no happening in the new Autores.Typescript (v6)

Copy link
Member

Choose a reason for hiding this comment

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

If JS allows it and the user sends it... does the server handle it correctly? If so, I have no problem here, otherwise I worry we'll get users into an error state they don't understand.

fullOptions,
{
...fullOptions,
searchText: searchText
Copy link
Member

Choose a reason for hiding this comment

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

This should always work, though technically we're supposed to honor whatever comes back from nextPageParameters, which includes searchText, which is being overridden here with the original value.

I think this is safe, but maybe @brjohnstmsft has feelings about it?

Copy link
Member Author

Choose a reason for hiding this comment

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

But, this is a private method right. So, this should work

Copy link
Member

Choose a reason for hiding this comment

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

Well the problem is the way paging work is the server sends us back the parameters to send for the next page... and it sends us all the parameters that it wants, which is the full query including searchText.

Technically it only modifies skip and top today, but we aren't supposed to rely on it.

I think this should be ok since I don't think the server would change the searchText between pages, even though it could.

Copy link
Member

Choose a reason for hiding this comment

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

Seems unlikely we'd change searchText between pages, but in the long run it's better to follow the service's contract for paging. That means nextPageParameters takes precedence.

sdk/search/search-documents/src/searchIndexClient.ts Outdated Show resolved Hide resolved
sdk/search/search-documents/src/serviceUtils.ts Outdated Show resolved Hide resolved
Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

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

I feel good enough to sign off on this now, though I'd like some follow-up on if the server supports improperly cased values for string enums.

@xirzec
Copy link
Member

xirzec commented Jun 3, 2020

Oh one other thing I forgot @sarangan12 can you please update changelog with all the breaking changes?

@sarangan12
Copy link
Member Author

Oh one other thing I forgot @sarangan12 can you please update changelog with all the breaking changes?

The changelog will be updated before release

@sarangan12 sarangan12 merged commit e924eaf into Azure:master Jun 3, 2020
@brjohnstmsft
Copy link
Member

I feel good enough to sign off on this now, though I'd like some follow-up on if the server supports improperly cased values for string enums.

You should assume that enums are case-sensitive.

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