Skip to content

[ACS - Chat] Data Retention Policy 2023-07-01-preview#22858

Merged
anuchandy merged 12 commits intomainfrom
LuChen-Microsoft-communication-Chat-2023-07-01-preview
Mar 27, 2023
Merged

[ACS - Chat] Data Retention Policy 2023-07-01-preview#22858
anuchandy merged 12 commits intomainfrom
LuChen-Microsoft-communication-Chat-2023-07-01-preview

Conversation

@LuChen-Microsoft
Copy link
Member

@LuChen-Microsoft LuChen-Microsoft commented Mar 2, 2023

ACS Chat is adding a RetentionPolicy property into Thread model. It is used to specify the retention policy for the thread. The retention policy specifies how long the thread should be retained. You can create a thread with a retention policy by setting the RetentionPolicy property of the Thread model to the desired retention policy. You can get the retention policy of a thread by reading the RetentionPolicy property of the Thread model.

Due to the support from dependencies, RetentionPolicy property of the Thread model is not able to be updated during the preview stage.

This is a PR generated at OpenAPI Hub. You can view your work branch via this link.

Data Plane API - Pull Request

API Info: The Basics

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

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 Open API document (swagger) if applicable, and the root paths that have been updated.

Differences: Open API HUB Comparing Version

Paths:
Post: "/chat/threads"
Get: "/chat/threads" "/chat/threads/{chatThreadId}"
PATCH: "/chat/threads/{chatThreadId}"

Here are the detailed changes:

1. Expose the Retention Policy Model

 "RetentionPolicy": {
      "description": "Data retention policy for auto deletion.",
      "type": "object",
      "discriminator": "policyType",
      "properties": {
        "policyType": {
          "description": "Retention Policy Type",
          "enum": [
            "threadCreationDate"
          ],
          "type": "string",
          "x-ms-enum": {
            "name": "policyType",
            "modelAsString": true,
            "values": [
              {
                "value": "threadCreationDate",
                "description": "Thread retention policy based on thread creation date."
              }
            ]
          }
        }
      },
      "required": [
        "policyType"
      ]
    },
    "ThreadCreationDateRetentionPolicy": {
      "description": "Thread retention policy based on thread creation date.",
      "type": "object",
      "x-ms-discriminator-value": "threadCreationDate",
      "allOf": [
        {
          "$ref": "#/definitions/RetentionPolicy"
        }
      ],
      "properties": {
        "daysAfterCreation": {
          "type": "integer",
          "format": "int32",
          "description": "Indicates how many days after the thread creation the thread will be deleted. Only 90 is accepted for now."
        }
      },
      "required": [
        "daysAfterCreation"
      ]
    }

For the potential support in future, we might add the new policy type into RetentionPolicy. (This is not included in current version change)

"BasedOnThreadLastActivityDateRetentionPolicy": {
      "description": "Thread retention policy based on thread last activity date.",
      "type": "object",
      "x-ms-discriminator-value": "basedOnThreadLastActivityDate",
      "allOf": [
        {
          "$ref": "#/definitions/RetentionPolicy"
        }
      ],
      "properties": {
        "daysAfterLastActivity": {
          "type": "integer",
          "format": "int32",
          "description": "Indicates how many days after the thread last activity the thread will be deleted. "
        }
      },
      "required": [
        "daysAfterLastActivity"
      ]
    }

2. Add an optional property RententionPolicy in Create Chat Thread:

"CreateChatThreadRequest": {
  "description": "Request payload for creating a chat thread.",
  "required": [
    "topic"
  ],
  "type": "object",
  "properties": {
    ...
    "retentionPolicy": {
      "$ref": "#/definitions/RetentionPolicy"
    }
  }
},

3. Add an optional property RententionPolicy when Get Chat Thread

"ChatThreadProperties": {
  "description": "Chat thread.",
  "required": [
    "createdByCommunicationIdentifier",
    "createdOn",
    "id",
    "topic"
  ],
  "type": "object",
  "properties": {
    ...
    "retentionPolicy": {
      "$ref": "#/definitions/RetentionPolicy"
    }
  }
}

❔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

fix #22880

@openapi-workflow-bot
Copy link

Hi, @LuChen-Microsoft Thanks for your PR. I am workflow bot for review process. Here are some small tips.

  • Please ensure to do self-check against checklists in first PR comment.
  • PR assignee is the person auto-assigned and responsible for your current PR reviewing and merging.
  • For specs comparison cross API versions, Use API Specs Comparison Report Generator
  • If there is CI failure(s), to fix CI error(s) is mandatory for PR merging; or you need to provide justification in PR comment for explanation. How to fix?

  • Any feedback about review process or workflow bot, pls contact swagger and tools team. vscswagger@microsoft.com

    @openapi-pipeline-app
    Copy link

    openapi-pipeline-app bot commented Mar 2, 2023

    Swagger Validation Report

    ️️✔️BreakingChange succeeded [Detail] [Expand]
    There are no breaking changes.
    ️️✔️Breaking Change(Cross-Version) succeeded [Detail] [Expand]
    There are no breaking changes.
    compared swaggers (via Oad v0.10.4)] new version base version
    communicationserviceschat.json 2023-07-01-preview(c8b37cd) 2021-09-07(main)
    communicationserviceschat.json 2023-07-01-preview(c8b37cd) 2023-04-01-preview(main)
    ️️✔️CredScan succeeded [Detail] [Expand]
    There is no credential detected.
    ️⚠️LintDiff: 2 Warnings warning [Detail]
    compared tags (via openapi-validator v2.0.0) new version base version
    package-chat-2023-07-01-preview package-chat-2023-07-01-preview(c8b37cd) default(main)

    [must fix]The following errors/warnings are introduced by current PR:

    Rule Message Related RPC [For API reviewers]
    ⚠️ PatchContentType A post operation should not consume 'application/merge-patch+json' content type.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L1132
    ⚠️ RequestBodyOptional The body parameter is not marked as required.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L1150


    The following errors/warnings exist before current PR submission:

    Only 30 items are listed, please refer to log for more details.

    Rule Message
    OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Chat' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L781
    OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Chat' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L858
    OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'ChatThread' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L934
    OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'ChatThread' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L1006
    OperationIdNounVerb Per the Noun_Verb convention for Operation Ids, the noun 'Chat' should not appear after the underscore. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L1069
    HostParametersValidation The host parameter must be typed 'type 'string', format 'url''.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L1844
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L20
    ⚠️ DefaultResponse Operation is missing a default response.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L45
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L52
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L59
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L66
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L73
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L104
    ⚠️ DefaultResponse Operation is missing a default response.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L124
    ⚠️ SuccessResponseBody All success responses except 202 & 204 should define a response body.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L125
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L128
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L135
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L142
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L149
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L178
    ⚠️ DefaultResponse Operation is missing a default response.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L198
    ⚠️ Post201Response Using post for a create operation is discouraged.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L199
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L205
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L212
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L219
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L226
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L250
    ⚠️ DefaultResponse Operation is missing a default response.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L275
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L282
    ⚠️ ErrorResponse Error response should contain a x-ms-error-code header.
    Location: Chat/preview/2023-07-01-preview/communicationserviceschat.json#L289
    ️️✔️Avocado succeeded [Detail] [Expand]
    Validation passes for Avocado.
    ️️✔️ApiReadinessCheck succeeded [Detail] [Expand]
    ️⚠️~[Staging] ServiceAPIReadinessTest: 0 Warnings warning [Detail]

    API Test is not triggered due to precheck failure. Check pipeline log for details.

    ️️✔️SwaggerAPIView succeeded [Detail] [Expand]
    ️️✔️CadlAPIView 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.
    ️️✔️PrettierCheck succeeded [Detail] [Expand]
    Validation passes for PrettierCheck.
    ️️✔️SpellCheck succeeded [Detail] [Expand]
    Validation passes for SpellCheck.
    ️️✔️Lint(RPaaS) succeeded [Detail] [Expand]
    Validation passes for Lint(RPaaS).
    ️️✔️CadlValidation succeeded [Detail] [Expand]
    Validation passes for CadlValidation.
    ️️✔️PR Summary succeeded [Detail] [Expand]
    Validation passes for Summary.
    Posted by Swagger Pipeline | How to fix these errors?

    @openapi-pipeline-app
    Copy link

    openapi-pipeline-app bot commented Mar 2, 2023

    Swagger pipeline restarted successfully, please wait for status update in this comment.

    @openapi-pipeline-app
    Copy link

    openapi-pipeline-app bot commented Mar 2, 2023

    Generated ApiView

    Language Package Name ApiView Link
    swagger communication-data-plane-Chat https://apiview.dev/Assemblies/Review/f24ce6901b6748c4a8567986cb56852d

    @LuChen-Microsoft
    Copy link
    Member Author

    /azp run unifiedPipeline

    @azure-pipelines
    Copy link

    No pipelines are associated with this pull request.

    @LuChen-Microsoft LuChen-Microsoft changed the title [Hub Generated] Review request for Chat to add version preview/2023-07-01-preview [ACS - Chat] Data Retention Policy 2023-07-01-preview Mar 2, 2023
    @LuChen-Microsoft
    Copy link
    Member Author

    /azp run unifiedPipeline

    @azure-pipelines
    Copy link

    No pipelines are associated with this pull request.

    @LuChen-Microsoft
    Copy link
    Member Author

    /azp run unifiedPipeline

    @azure-pipelines
    Copy link

    No pipelines are associated with this pull request.

    @LuChen-Microsoft LuChen-Microsoft marked this pull request as ready for review March 3, 2023 01:19
    @LuChen-Microsoft LuChen-Microsoft requested a review from a team as a code owner March 3, 2023 01:19
    @LuChen-Microsoft LuChen-Microsoft requested review from JeffreyRichter and mikekistler and removed request for a team March 3, 2023 01:19
    @JeffreyRichter
    Copy link
    Member

    You have to tell me exaclty what you want reviewed here. You don't need the whole thing reviewed, right?
    Right away, I see POST /chat/threads/{chatThreadId}/typing doesn't look right. You want a colon before "typing" I think.
    I also see non-2xx status codes in the swagger; we don't put these in swagger.

    @ghost
    Copy link

    ghost commented Mar 19, 2023

    Hi, @LuChen-Microsoft. 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.

    @LuChen-Microsoft
    Copy link
    Member Author

    You have to tell me exaclty what you want reviewed here. You don't need the whole thing reviewed, right? Right away, I see POST /chat/threads/{chatThreadId}/typing doesn't look right. You want a colon before "typing" I think. I also see non-2xx status codes in the swagger; we don't put these in swagger.

    Hi @JeffreyRichter , thanks for the comment. I added the description. Here's the Open API differences between the change with our current stable version:

    Open API HUB Comparing Version

    Updated Paths:
    Post: "/chat/threads"
    Get: "/chat/threads" "/chat/threads/{chatThreadId}"
    PATCH: "/chat/threads/{chatThreadId}"

    @JeffreyRichter
    Copy link
    Member

    It looks fine to me but I still see non-2xx codes in the swagger and they shouldn't be there.

    Copy link
    Member

    @JeffreyRichter JeffreyRichter left a comment

    Choose a reason for hiding this comment

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

    Please remove all non-2xx codes from swagger

    @openapi-workflow-bot
    Copy link

    Hi @LuChen-Microsoft, Your PR has some issues. Please fix the CI sequentially by following the order of Avocado, semantic validation, model validation, breaking change, lintDiff. If you have any questions, please post your questions in this channel https://aka.ms/swaggersupport.

    TaskHow to fixPriority
    AvocadoFix-AvocadoHigh
    Semantic validationFix-SemanticValidation-ErrorHigh
    Model validationFix-ModelValidation-ErrorHigh
    LintDiffFix-LintDiffhigh
    If you need further help, please feedback via swagger feedback.

    - Rename the `BaseOnThreadCreationDateRetentionPolicy` to `ThreadCreationDateRetentionPolicy`
    @mikekistler mikekistler added the APIStewardshipBoard-SignedOff The Azure API Stewardship team has reviewed and approved the changes. label Mar 24, 2023
    @anuchandy anuchandy merged commit 168c172 into main Mar 27, 2023
    @anuchandy anuchandy deleted the LuChen-Microsoft-communication-Chat-2023-07-01-preview branch March 27, 2023 21:27
    @LuChen-Microsoft
    Copy link
    Member Author

    Please remove all non-2xx codes from swagger

    Thanks! Created a separate item to remove them.

    JoshLove-msft pushed a commit to JoshLove-msft/azure-rest-api-specs that referenced this pull request Apr 25, 2023
    * Adds base for updating Chat from version stable/2021-09-07 to version 2023-07-01-preview
    
    * Updates readme
    
    * Updates API version in new specs and examples
    
    * add retention policy
    
    * add examples change
    
    * update readme
    
    * fix stable version
    
    * fix validations
    
    * merge the changes with image sharing
    
    * remove unused example
    
    * - Remove the retention policy from updat chat thread
    - Rename the `BaseOnThreadCreationDateRetentionPolicy` to `ThreadCreationDateRetentionPolicy`
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    ACS APIStewardshipBoard-SignedOff The Azure API Stewardship team has reviewed and approved the changes. data-plane

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    [IC3 ACS Chat] API Review

    5 participants