Skip to content

Commit 7cb3568

Browse files
authored
Generate model for all the dictionaries and add support for unixtime (#685)
* Enable two test cases, and drop the workaround for x-ms-enum * Add utils folder include a script to decrypt securestring * Generate model for all the dictionaries and add support for unixtime
1 parent 5bfd3a1 commit 7cb3568

File tree

5 files changed

+96
-1
lines changed

5 files changed

+96
-1
lines changed

powershell/llcsharp/model/namespace.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ export class NewModelsNamespace extends Namespace {
179179
this.NewResolveTypeDeclaration(schema, true, <NewState>state);
180180
}
181181
}
182+
if (schemas.dictionaries) {
183+
for (const schema of schemas.dictionaries) {
184+
this.NewResolveTypeDeclaration(schema, true, <NewState>state);
185+
}
186+
}
182187

183188
if (schemas.any) {
184189
for (const schema of schemas.any) {

powershell/llcsharp/schema/schema-resolver.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { codeModelSchema, ArraySchema, CodeModel, Schema as NewSchema, StringSchema, BooleanSchema, NumberSchema, ByteArraySchema, DateTimeSchema, ObjectSchema, GroupSchema, isObjectSchema, SchemaType, GroupProperty, ParameterLocation, Operation, Parameter, VirtualParameter, getAllProperties, ImplementationLocation, OperationGroup, Request, SchemaContext, ConstantSchema, ChoiceSchema, DurationSchema, BinarySchema, DateSchema } from '@azure-tools/codemodel';
6+
import { codeModelSchema, ArraySchema, UnixTimeSchema, CodeModel, Schema as NewSchema, StringSchema, BooleanSchema, NumberSchema, ByteArraySchema, DateTimeSchema, ObjectSchema, GroupSchema, isObjectSchema, SchemaType, GroupProperty, ParameterLocation, Operation, Parameter, VirtualParameter, getAllProperties, ImplementationLocation, OperationGroup, Request, SchemaContext, ConstantSchema, ChoiceSchema, DurationSchema, BinarySchema, DateSchema } from '@azure-tools/codemodel';
77

88
import { ModelState, codemodel, IntegerFormat, NumberFormat, StringFormat, JsonType } from '@azure-tools/codemodel-v3';
99
import { Schema } from '../code-model';
@@ -222,6 +222,9 @@ export class NewSchemaDefinitionResolver {
222222
// fallback to int if the format isn't recognized
223223
return new NewNumeric(<NumberSchema>schema, required, required ? 'int' : 'int?');
224224

225+
case SchemaType.UnixTime:
226+
return new NewUnixTime(<UnixTimeSchema>schema, required);
227+
225228
case SchemaType.Number:
226229
switch ((<NumberSchema>schema).precision) {
227230
case 64:

tests-upgrade/Configuration.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"datamodels-datatypes-integer",
2525
"datamodels-datatypes-string",
2626
"datamodels-datatypes-object",
27+
"datamodels-datatypes-unixtime",
2728
"datamodels-combineschema",
2829
"directive-model",
2930
"directive-tableformat",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### AutoRest Configuration
2+
> see https://aka.ms/autorest
3+
4+
``` yaml
5+
require:
6+
- $(this-folder)/../readme.azure.noprofile.md
7+
input-file:
8+
- $(this-folder)/swagger.json
9+
10+
```
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "DatabricksClient",
5+
"version": "2018-04-01",
6+
"description": "ARM Databricks"
7+
},
8+
"host": "management.azure.com",
9+
"schemes": [
10+
"https"
11+
],
12+
"consumes": [
13+
"application/json"
14+
],
15+
"produces": [
16+
"application/json"
17+
],
18+
"security": [
19+
{
20+
"azure_auth": [
21+
"user_impersonation"
22+
]
23+
}
24+
],
25+
"securityDefinitions": {
26+
"azure_auth": {
27+
"type": "oauth2",
28+
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
29+
"flow": "implicit",
30+
"description": "Azure Active Directory OAuth2 Flow",
31+
"scopes": {
32+
"user_impersonation": "impersonate your user account"
33+
}
34+
}
35+
},
36+
"paths": {
37+
"/subscriptions/resourceGroup": {
38+
"get": {
39+
"tags": [
40+
"Workspaces"
41+
],
42+
"operationId": "Workspaces_Get",
43+
"description": "Gets the workspace.",
44+
"responses": {
45+
"200": {
46+
"description": "OK-Return workspace."
47+
},
48+
"default": {
49+
"description": "Error response describing why the operation failed.",
50+
"schema": {
51+
"$ref": "#/definitions/BasicErrorModel"
52+
}
53+
}
54+
}
55+
}
56+
}
57+
},
58+
"definitions": {
59+
"BasicErrorModel": {
60+
"type": "object",
61+
"required": [
62+
"message",
63+
"code"
64+
],
65+
"properties": {
66+
"message": {
67+
"type": "string"
68+
},
69+
"code": {
70+
"type": "integer",
71+
"format": "unixtime"
72+
}
73+
}
74+
}
75+
}
76+
}

0 commit comments

Comments
 (0)