Skip to content

Deprecating older packages#19897

Closed
joheredi wants to merge 3 commits intoAzure:mainfrom
joheredi:update-agrifood
Closed

Deprecating older packages#19897
joheredi wants to merge 3 commits intoAzure:mainfrom
joheredi:update-agrifood

Conversation

@joheredi
Copy link
Copy Markdown
Member

Checklists

  • Added impacted package name to the issue description

Packages impacted by this PR:

  • @azure-rest/purview-account - Deprecated in favor of @azure-rest/purview-administration which includes purview account
  • @azure-rest/core-client-paging - Deprecated in favor of @azure/core-paging
  • @azure-rest/core-client-lro - Deprecated in favor of @azure/core-lro
  • @azure-rest/agrifood-farming - Re-generated using the latest codegen version and swagger, which updates paging and lro dependencies.

Issues associated with this PR:
#18729

Describe the problem that is addressed by this PR:
There are a few packages that need to be drprecated. This PR drops any dependencies on those packages and removes code from the repository to prepare for deprecation. After this PR is merged NPM packages will be marked as deprecated

Command used to generate this PR:(Applicable only to SDK release request PRs)
rushx generate:client for agrifood-farming

Copy link
Copy Markdown
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 really like that we are able to re-use the same core packages for REST now.

I think it would have felt a little better to do the FarmBeats change in a separate PR from the removals, especially since its API surface is unreviewably large, but I didn't think of that until I scrolled through most of it. I left a few comments :)

Comment thread rush.json
"versionPolicyName": "core"
},
{
"packageName": "@azure-rest/core-client-lro",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

were any of these in the vs code workspace file?

area?: Measure;
associatedBoundaryId?: string;
attachmentsLink?: string;
avgMaterial?: Measure;
createdDateTime?: Date;
createdDateTime?: Date | string;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this feels strange to me. Presumably if it's a string, it's something we can parse into a Date, so why make the consumer have to handle both?

operationEndDateTime?: Date | string;
operationModifiedDateTime?: Date | string;
operationStartDateTime?: Date | string;
properties?: Record<string, Record<string, unknown>>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So it's a property bag of property bags? The previous type was just Record<string, unknown> so why the additional nesting?

Description?: string;
ETag?: string;
FarmerId?: string;
file?: string | Uint8Array;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wonder if this should eventually support streams...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like these are form-encoded in the request, so maybe we have to collect it into a buffer anyway before sending? I'm interested in whether that can be supported without core support for doing it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah we need to support streams. I'm planning to pick up again the RLC work to support streams now that we have the fetch client available.

Right now I believe we'd just be able to send the file if it is loaded in memory as a Uint8Array or string, which of course is problematic for larg files.

I think I'll take on this for the March milestone

*
###### Note:
*
1. The **‘contentType’** in the request header should be **'application/merge-patch+json'**.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it feels strange that we are doing **'contentType'** - especially since the single quotes look like smart quotes?

Also the header is "Content-Type" not "contentType"... but I am guessing this remark comes from swagger?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah this is coming from the Swagger

@joheredi joheredi requested a review from weshaggard as a code owner January 19, 2022 00:23
@azure-sdk
Copy link
Copy Markdown
Collaborator

API changes have been detected in @azure-rest/agrifood-farming. You can review API changes here

Copy link
Copy Markdown
Member

@witemple-msft witemple-msft left a comment

Choose a reason for hiding this comment

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

Couple of comments I noticed passing through.

names?: Array<string>;
operationBoundaryIds?: Array<string>;
propertyFilters?: Array<string>;
sources?: Array<string>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have to wonder why all the X[] types changed to Array<X>. Most style guides I've read prefer the former.

Copy link
Copy Markdown
Member Author

@joheredi joheredi Jan 21, 2022

Choose a reason for hiding this comment

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

Thanks Will, Is there any difference for Typescript when using Array<X> vs X[]?

I have filed an issue to track RLC design questions and added this one. Azure/autorest.typescript#1286

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, there is no type-level difference, just a stylistic one.

minOperationEndDateTime?: Date;
minOperationModifiedDateTime?: Date;
minOperationStartDateTime?: Date;
minCreatedDateTime?: Date | string;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Feels pretty bad to have to constantly check to see if a value is a Date instance or a date-formatted string.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hi Will, we are generating this union for Input types only, Output is always a string because we cannot safely deserialize without runtime mapping*.

(*note that this is an RLC which don't have any runtime mapping)

The reason these inputs are string or Date is to give the user a chance to work with them as it is more convenient for their use case.

For example, if they are round-tripping data from and to the service it may be more convenient to just take the date as received from the service and put it in the request without having to convert it to a Date. On the other hand, if users are crafting a request from scratch, it may be more convenient to say Date.now() than crafting the date as a string.

I believe this has value, especially since it is for input types, users shouldn't need flow control to work with these types.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it is for input types

I didn't catch this! If it's for inputs but not outputs then it doesn't feel bad anymore.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I also didn't see that it was only for input types 😅

That's a cool feature though and I like it alot!

Description?: string;
ETag?: string;
FarmerId?: string;
file?: string | Uint8Array;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like these are form-encoded in the request, so maybe we have to collect it into a buffer anyway before sending? I'm interested in whether that can be supported without core support for doing it.

name?: string;
properties?: FarmerPropertiesDictionary;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see any other instances of this type name other than its deletion here. Did we mean to change these from named property bags to anonymous maps to any?

@joheredi
Copy link
Copy Markdown
Member Author

Abandoning this PR to split it in 2. The first one #20059 will update Agrifood with the latest code gen version and remove dependency in the packages about to be deprecated. Following a PR to delete the deprecated code

@joheredi joheredi closed this Jan 25, 2022
ghost pushed a commit that referenced this pull request Jan 27, 2022
**Checklists** 
- [x] Added impacted package name to the issue description

**Packages impacted by this PR:**
@azure-rest/agrifood-farming

**Describe the problem that is addressed by this PR:**
Re-generate Agrifood Farming using the latest version of RLC generator. This package was one of the first-ever RLCs generated and codegen has changes quite a bit since then. Regenerating against the same swagger. Major changes since last generation:

- Switched away from @azure-rest/core-client-lro and @azure-rest/core-client-paging in favor of @azure/core-lro and @azure/core-client
- Split Output and Input models



**Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_
NO

**Are there test cases added in this PR?**_(If not, why?)_
NO, it already has tests

**Provide a list of related PRs**_(if any)_
#19897

**Command used to generate this PR:**_(Applicable only to SDK release request PRs)_
`rushx generate:client`
sadasant pushed a commit to sadasant/azure-sdk-for-js that referenced this pull request Jan 28, 2022
**Checklists** 
- [x] Added impacted package name to the issue description

**Packages impacted by this PR:**
@azure-rest/agrifood-farming

**Describe the problem that is addressed by this PR:**
Re-generate Agrifood Farming using the latest version of RLC generator. This package was one of the first-ever RLCs generated and codegen has changes quite a bit since then. Regenerating against the same swagger. Major changes since last generation:

- Switched away from @azure-rest/core-client-lro and @azure-rest/core-client-paging in favor of @azure/core-lro and @azure/core-client
- Split Output and Input models



**Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_
NO

**Are there test cases added in this PR?**_(If not, why?)_
NO, it already has tests

**Provide a list of related PRs**_(if any)_
Azure#19897

**Command used to generate this PR:**_(Applicable only to SDK release request PRs)_
`rushx generate:client`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants