Skip to content

Commit 0dbb194

Browse files
authored
Adds OData count paths support (#1935)
* Change OData count path content-type to application/json * Add ConsistencyLevel completer * Simplify consistency level directive
1 parent 751dd89 commit 0dbb194

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/readme.graph.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,13 @@ directive:
394394
- Body
395395
- DueDateTime
396396
- Importance
397+
- where:
398+
parameter-name: ConsistencyLevel
399+
set:
400+
completer:
401+
name: ConsistencyLevel Completer
402+
description: Gets the list of ConsistencyLevel header values.
403+
script: "'eventual'"
397404
# Rename parameters.
398405
- where:
399406
variant: ^(Add|Insert|Apply|Approve|Unset|Clear|Wipe|Check|Copy|Disable|Locate|Get|Delta|Abort|Accept|Answer|Autofit|Bounding|Cell|Clean|Column|Columns|Commit|Decline|Dismiss|Down|Entire|Filter|Forward|Intersection|Invite|Keep|Last|Logout|Mute|Offset|Play|Preview|Range|Reassign|Reauthorize|Record|Redirect|Reject|Renew|Reply|Retire|Return|Row|Rows|Scan|Schedule|Snooze|Subscribe|Supported|Target|Time|Unmerge|Unmute|Unsubmit|View|Associate|Lock|Merge|Transfer|Move|Create|Update|Publish|Delete|Remove|Change|Request|Reset|Reboot|Restore|Recover|Send|Set|Assign|Bypass|Start|Cancel|Stop|Submit|Sync|Is|Unpublish|Purge|Close|Compare|Complete|Verify|Confirm|Clone|Disconnect|Enable|Export|Discover|Find|Acquire|Managed|Top|Grant|Hide|Import|Activate|Account|Archive|As|Batch|Begin|Bulk|Calendar|Clock|Cloud|Consent|Custom|Deprovision|Access|Estimate|Execute|Extend|Extract|Post|Force|Functions|Has|Have|Instantiate|Invalidate|License|Mark|Messages|Override|Parse|Pending|Postpone|Reactivate|Recent|Reenable|Reopen|Report|Reprovision|Reupload|Role|Rotate|Scoped|Self|Shared|Share|Soft|Summarize|Translate|Troubleshoot|Unarchive|Unassign|Unhide|Unshare|Unsubscribe|Upload|Users|Migrate|Provision|Generate|Make|Ping|Release|Rename|Resize|Restart|Resume|Revoke|Search|Trigger|Run|End|Pause|Validate|Evaluate|Unblock|Undo|Upgrade|Reprocess|Patch)\d*$
@@ -468,6 +475,23 @@ directive:
468475
verb: New|Remove|Update|Get
469476
subject: ^(.*)(IdentityGovernance)TermOfUse$
470477
remove: true
478+
# Modify OpenAPI documents to correct AutoREST.PowerShell limitations.
479+
# Change content-type from text/plain to application/json. AutoREST does not support non-json content types.
480+
# See https://github.com/Azure/autorest.powershell/issues/206.
481+
- from: 'openapi-document'
482+
where: $.components.responses.ODataCountResponse.content
483+
transform: >-
484+
return {
485+
"application/json": {
486+
"schema" : {
487+
"$ref" : '#/components/schemas/ODataCountResponse'
488+
}
489+
}
490+
}
491+
# Mark consistency level parameter as required for /$count paths when header is present.
492+
- from: openapi-document
493+
where: $..paths.*[?(/(.*_GetCount)/gmi.exec(@.operationId))]..parameters[?(@.name === "ConsistencyLevel")]
494+
transform: $['required'] = true
471495
# Modify generated .json.cs model classes.
472496
- from: source-file-csharp
473497
where: $

0 commit comments

Comments
 (0)