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

New API preview version for ACS Email Inline Attachment feature #29699

Merged

Conversation

natekimball-msft
Copy link
Member

Data Plane API Specification Update Pull Request

Tip

Overwhelmed by all this guidance? See the Getting help section at the bottom of this PR description.

PR review workflow diagram

Please understand this diagram before proceeding. It explains how to get your PR approved & merged.

spec_pr_review_workflow_diagram

API Info: The Basics

Most of the information about your service should be captured in the issue that serves as your API Spec engagement record.

  • Link to API Spec engagement record issue:

Is this review for (select one):

  • a private preview
  • a public preview
  • GA release

Change Scope

This section will help us focus on the specific parts of your API that are new or have been modified.
Please share a link to the design document for the new APIs, a link to the previous API Spec document (if applicable), and the root paths that have been updated.

  • Design Document: ACS Email - CID Embedded Inline Images
  • Previous API Spec Doc: N/A (Original ACS Email REST API Design Doc)
  • Updated paths: /emails:send, specifically, the addition of contentId to the EmailAttachment definition, and updated description for attachments in EmailMessage definition. The SendEmail.json example has also been updated with sample usage of an inline image.

Viewing API changes

For convenient view of the API changes made by this PR, refer to the URLs provided in the table
in the Generated ApiView comment added to this PR. You can use ApiView to show API versions diff.

Suppressing failures

If one or multiple validation error/warning suppression(s) is detected in your PR, please follow the
Swagger-Suppression-Process
to get approval.

❔Got questions? Need additional info?? We are here to help!

Contact us!

The Azure API Review Board is dedicated to helping you create amazing APIs. You can read about our mission and learn more about our process on our wiki.

Click here for links to tools, specs, guidelines & other good stuff

Tooling

Guidelines & Specifications

Helpful Links

Getting help

  • First, please carefully read through this PR description, from top to bottom.
  • If you don't have permissions to remove or add labels to the PR, request write access per aka.ms/azsdk/access#request-access-to-rest-api-or-sdk-repositories
  • To understand what you must do next to merge this PR, see the Next Steps to Merge comment. It will appear within few minutes of submitting this PR and will continue to be up-to-date with current PR state.
  • For guidance on fixing this PR CI check failures, see the hyperlinks provided in given failure
    and https://aka.ms/ci-fix.
  • If the PR CI checks appear to be stuck in queued state, please add a comment with contents /azp run.
    This should result in a new comment denoting a PR validation pipeline has started and the checks should be updated after few minutes.
  • If the help provided by the previous points is not enough, post to https://aka.ms/azsdk/support/specreview-channel and link to this PR.

@natekimball-msft natekimball-msft requested a review from a team as a code owner July 4, 2024 05:08
@natekimball-msft natekimball-msft requested review from mikekistler and marclerwick and removed request for a team July 4, 2024 05:08
Copy link

openapi-pipeline-app bot commented Jul 4, 2024

Next Steps to Merge

✅ All automated merging requirements have been met! To get your PR merged, see aka.ms/azsdk/specreview/merge.

Copy link

openapi-pipeline-app bot commented Jul 4, 2024

Swagger Validation Report

️️✔️BreakingChange succeeded [Detail] [Expand]
There are no breaking changes.
️⚠️Breaking Change(Cross-Version): 1 Warnings warning [Detail]
Compared specs (v0.10.12) new version base version
CommunicationServicesEmail.json 2024-07-01-preview(1a44c19) 2023-03-31(main)
CommunicationServicesEmail.json 2024-07-01-preview(1a44c19) 2023-01-15-preview(main)

The following breaking changes are detected by comparison with the latest preview version:

Rule Message
⚠️ 1023 - TypeFormatChanged The new version has a different format 'byte' than the previous one ''.
New: Email/preview/2024-07-01-preview/CommunicationServicesEmail.json#L305:9
Old: Email/preview/2023-01-15-preview/CommunicationServicesEmail.json#L305:9
️️✔️CredScan succeeded [Detail] [Expand]
There is no credential detected.
️⚠️LintDiff: 0 Warnings warning [Detail]
Compared specs (v2.2.2) new version base version
package-2024-07-01-preview package-2024-07-01-preview(1a44c19) default(main)

The following errors/warnings exist before current PR submission:

Rule Message
⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
Location: Email/preview/2024-07-01-preview/CommunicationServicesEmail.json#L20
⚠️ ErrorResponse Error schema should define code and message properties as required.
Location: Email/preview/2024-07-01-preview/CommunicationServicesEmail.json#L40
⚠️ ErrorResponse The error property in the error response schema should be required.
Location: Email/preview/2024-07-01-preview/CommunicationServicesEmail.json#L40
⚠️ ErrorResponse Error schema should define code and message properties as required.
Location: Email/preview/2024-07-01-preview/CommunicationServicesEmail.json#L125
⚠️ ErrorResponse The error property in the error response schema should be required.
Location: Email/preview/2024-07-01-preview/CommunicationServicesEmail.json#L125
⚠️ EnumInsteadOfBoolean Booleans properties are not descriptive in all cases and can make them to use, evaluate whether is makes sense to keep the property as boolean or turn it into an enum.
Location: Email/preview/2024-07-01-preview/CommunicationServicesEmail.json#L237
️️✔️Avocado succeeded [Detail] [Expand]
Validation passes for Avocado.
️️✔️SwaggerAPIView succeeded [Detail] [Expand]
️️✔️TypeSpecAPIView succeeded [Detail] [Expand]
️️✔️ModelValidation succeeded [Detail] [Expand]
Validation passes for ModelValidation.
️️✔️SemanticValidation succeeded [Detail] [Expand]
Validation passes for SemanticValidation.
️️✔️PoliCheck succeeded [Detail] [Expand]
Validation passed for PoliCheck.
️️✔️SpellCheck succeeded [Detail] [Expand]
Validation passes for SpellCheck.
️️✔️Lint(RPaaS) succeeded [Detail] [Expand]
Validation passes for Lint(RPaaS).
️️✔️PR Summary succeeded [Detail] [Expand]
Validation passes for Summary.
️️✔️Automated merging requirements met succeeded [Detail] [Expand]
Posted by Swagger Pipeline | How to fix these errors?

Copy link

openapi-pipeline-app bot commented Jul 4, 2024

Swagger Generation Artifacts

️️✔️ApiDocPreview succeeded [Detail] [Expand]
 Please click here to preview with your @microsoft account. 
Posted by Swagger Pipeline | How to fix these errors?

Copy link

openapi-pipeline-app bot commented Jul 4, 2024

Generated ApiView

Language Package Name ApiView Link
Swagger Email https://apiview.dev/Assemblies/Review/e8d19e9096c64b449f7e9a73d6fe894a?revisionId=3833e53be90d499798f6c155e3b35303

@mikeharder
Copy link
Member

I believe the failure in check Breaking Change(Cross-Version) is caused by your examples setting header retry-after to an int when the schema expects a string. Since the bug is already in your examples in main, you will need to open another PR to fix your examples in main, and then the check will run successfully in this PR.

"responses": {
"200": {
"headers": {
"retry-after": 100
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"retry-after": 100
"retry-after": "100"

"202": {
"headers": {
"Operation-Location": "https://contoso.westus.communications.azure.com//emails/operations/8540c0de-899f-5cce-acb5-3ec493af3800?api-version=2023-03-31",
"retry-after": 20
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"retry-after": 20
"retry-after": "20"

"headers": {
"retry-after": {
"description": "This header will only be present when the status is a non-terminal status. It indicates the minimum amount of time in seconds to wait before polling for operation status again.",
"type": "integer",
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure this should be integer instead of string? The HTTP spec seems to require string to support date-based values.

https://www.rfc-editor.org/rfc/rfc9110#field.retry-after

Copy link
Member Author

Choose a reason for hiding this comment

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

I can check the historical reasoning of this choice with the team and get back to you. That being said, I have a couple of follow up questions here:

If it's the spec that is incorrect, I'm curious as to why these errors are only manifesting in our builds now, despite using the same version of autorest? It appears that it wasn't caught in our team's previous PRs. Examples: Add base64 formatting to contentInBase64 property by kagbakpem · Pull Request #24617 · Azure/azure-rest-api-specs (github.com), Azure Communication Services Email API for GA by apattath · Pull Request #22979 · Azure/azure-rest-api-specs (github.com).

If I make changes to the older specs retroactively, are there any considerations here with introducing breaking changes? It seems like in our most recent PR, a tag was added to approve a breaking change (unsure if it was for the same reason). Is that appropriate here?

Copy link
Member

Choose a reason for hiding this comment

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

For breaking changes, we regard the service behavior as the "source of truth". If the API definition changes to more accurately describe the service behavior, we allow this and actually encourage it.

Copy link
Member

Choose a reason for hiding this comment

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

The check also failed in PR 22979. For PR 24617, the check was bypassed using label Approved-BreakingChange, and we no longer have the build log, but I suspect it also failed with the same error.

I think the first question here, is how should retry-after be expressed in services, specs, and examples? Always a string, or can each service decide between string and integer?

For instance, even though the HTTP spec allows string dates, if a service has decided it will ever only send integer seconds in the header, would it be appropriate for the service and spec to use integer?

@mikekistler: Do you know the answer?

Copy link
Member

Choose a reason for hiding this comment

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

We always want the value of retry-after to be "delay-seconds" and not a date, and RFC 7231 says:

A delay-seconds value is a non-negative decimal integer, representing time in seconds.

So integer is the appropriate type for this header value.

Furthermore, it is common that string and integer values are serialized in headers in the same way, so it might be possible to change the API description from type: string to type: integer in a non-breaking way (i.e. without changing the behavior of the service). As long as the service does not wrap the value in quotes, e.g.

Retry-after: "180"

but most services will not do this so it might be fine.

Copy link
Member

@mikeharder mikeharder Jul 8, 2024

Choose a reason for hiding this comment

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

We always want the value of retry-after to be "delay-seconds" and not a date

@mikekistler: Can you elaborate on this? Is this an Azure guideline above the HTTP spec (which allows either)? Why wouldn't we want to give services the option to send either seconds or a date?

I understand it's valid for a service to choose to always send delay-seconds, and we may have reasons to prefer it (e.g. performance generating the response). But putting this restriction in the spec seems like overkill to me.

The guidance was changed recently in this PR (microsoft/api-guidelines#517), but even here it says SHOULD (not MUST) use delay-seconds:

DO include a retry-after header in the response if the operation is not complete. The value of this header should be an integer number of seconds that the client should wait before polling the status monitor again.

Though it does use MUST in another place:

The response must look like this:

200 OK
retry-after: <delay-seconds>    (if status not terminal)
<JSON Status Monitor Resource in body>

One more question, is the guidance to always use delay-seconds specific to 200 responses, or should it also apply to 202 responses? The spec in this PR has a retry-after example for both response codes.

Copy link
Member

@mikekistler mikekistler Jul 11, 2024

Choose a reason for hiding this comment

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

Retry-after should always specify delay-seconds in any response.

Copy link
Member

@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

@mikekistler mikekistler added the APIStewardshipBoard-SignedOff The Azure API Stewardship team has reviewed and approved the changes. label Jul 11, 2024
@natekimball-msft natekimball-msft added the PublishToCustomers Acknowledgement the changes will be published to Azure customers. label Jul 11, 2024
Copy link
Member

@kagbakpem kagbakpem left a comment

Choose a reason for hiding this comment

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

Let's hold off on merging this PR until the changes are reflected on the service side. 2024-07-01-preview.

Copy link
Contributor

Hi, @natekimball-msft. Your PR has no update for 14 days and it is marked as stale PR. If no further update for over 14 days, the bot will close the PR. If you want to refresh the PR, please remove no-recent-activity label.

@microsoft-github-policy-service microsoft-github-policy-service bot added the no-recent-activity There has been no recent activity on this issue. label Jul 29, 2024
@natekimball-msft natekimball-msft removed the no-recent-activity There has been no recent activity on this issue. label Jul 29, 2024
@natekimball-msft natekimball-msft enabled auto-merge (squash) August 9, 2024 22:07
@natekimball-msft natekimball-msft merged commit 8276d8b into Azure:main Aug 9, 2024
29 of 30 checks passed
natekimball-msft added a commit to Azure/azure-sdk-for-js that referenced this pull request Sep 20, 2024
### Packages impacted by this PR

azure/communication-email

### Issues associated with this PR

N/A

### Describe the problem that is addressed by this PR

N/A

### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?

N/A - update to include contentId property for EmailAttachment to
support inline attachments.

### Are there test cases added in this PR? _(If not, why?)_

Yes

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

[Java SDK PR](Azure/azure-sdk-for-java#41591)
[.NET SDK PR](Azure/azure-sdk-for-net#45360)
[REST API PR
(complete)](Azure/azure-rest-api-specs#29699)

### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

Git command?
git push --set-upstream origin
natekimball/update-js-sdk-for-inline-attachments

### Checklists
- [X] Added impacted package name to the issue description
- [ ] 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)_
- [X] Added a changelog (if necessary)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIStewardshipBoard-SignedOff The Azure API Stewardship team has reviewed and approved the changes. data-plane new-api-version PublishToCustomers Acknowledgement the changes will be published to Azure customers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants