1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
## Azure Container Registry for Python
### Settings
``` yaml
title: Container Registry
input-file: https://github.com/Azure/azure-rest-api-specs/blob/c8d9a26a2857828e095903efa72512cf3a76c15d/specification/containerregistry/data-plane/Azure.ContainerRegistry/stable/2021-07-01/containerregistry.json
output-folder: "../azure/containerregistry/_generated"
no-namespace-folders: true
python: true
clear-output-folder: true
```
### Correct Security to be separately defined
``` yaml
directive:
from: swagger-document
where: $
transform: >
$.security = [
{
"registry_oauth2": []
},
{
"registry_auth": []
}
]
```
## Customizations for Track 2 Generator
See the [AutoRest samples](https://github.com/Azure/autorest/tree/master/Samples/3b-custom-transformations)
for more about how we're customizing things.
### Rename the enum "TagOrderBy" to "ArtifactTagOrder"
``` yaml
directive:
from: swagger-document
where: $.definitions.TagOrderBy
transform: >
$['x-ms-enum']["name"] = "ArtifactTagOrder"
```
### Rename the enum "ManifestOrderBy" to "ArtifactManifestOrder"
``` yaml
directive:
from: swagger-document
where: $.definitions.ManifestOrderBy
transform: >
$['x-ms-enum']["name"] = "ArtifactManifestOrder"
```
### Remove response for "ContainerRegistry_DeleteRepository" operation
so that the generate code doesn't return a response for the delete repository operation.
```yaml
directive:
- from: swagger-document
where: $["paths"]["/acr/v1/{name}"]
transform: >
delete $.delete["responses"]["202"].schema
```
### Remove "Authentication_GetAcrAccessTokenFromLogin" operation
as the service team discourage using username/password to authenticate.
```yaml
directive:
- from: swagger-document
where: $["paths"]["/oauth2/token"]
transform: >
delete $.get
```
### Remove "definitions.TagAttributesBase.properties.signed"
as we don't have a SDK client customer scenario using it.
```yaml
directive:
- from: swagger-document
where: $.definitions.TagAttributesBase
transform: >
delete $.properties.signed
```
### Remove "definitions.ManifestAttributesBase.properties.configMediaType"
as we don't have a SDK client customer scenario using it.
```yaml
directive:
- from: swagger-document
where: $.definitions.ManifestAttributesBase
transform: >
delete $.properties.configMediaType
```
### Change "parameters.ApiVersionParameter.required" to true
so that the generated client/clientcontext constructors take api_version as a parameter.
```yaml
directive:
- from: swagger-document
where: $.parameters.ApiVersionParameter
transform: >
$.required = true
```
# Change NextLink client name to nextLink
``` yaml
directive:
from: swagger-document
where: $.parameters.NextLink
transform: >
$["x-ms-client-name"] = "nextLink"
```
# Updates to OciManifest
``` yaml
directive:
from: swagger-document
where: $.definitions.OCIManifest
transform: >
$["x-csharp-usage"] = "model,input,output,converter";
$["x-csharp-formats"] = "json";
delete $["x-accessibility"];
delete $["allOf"];
$.properties["schemaVersion"] = {
"type": "integer",
"description": "Schema version"
};
```
# Take stream as manifest body
``` yaml
directive:
from: swagger-document
where: $.parameters.ManifestBody
transform: >
$.schema = {
"type": "string",
"format": "binary"
}
```
# Make ArtifactBlobDescriptor a public type
``` yaml
directive:
from: swagger-document
where: $.definitions.Descriptor
transform: >
delete $["x-accessibility"]
```
# Make OciAnnotations a public type
``` yaml
directive:
from: swagger-document
where: $.definitions.Annotations
transform: >
delete $["x-accessibility"]
```
``` yaml
directive:
from: swagger-document
where-operation: ContainerRegistry_GetManifest
transform: >
$.parameters = $.parameters.filter(item => item.name !== "accept")
```
|