Skip to content

Commit

Permalink
Anonymous models inline support (#2072)
Browse files Browse the repository at this point in the history
* Update the changes

* Support anomymous model simple cases in modular and rlc

* Update the anomymousModel.spec

* Update the test cases

* Update the ut for anomymousModel

* Revert changes in rlc-common

* Refactor the RLC code

* Upgrade the eslint version

* Update the test cases

* Update log

* Update the record ut

* Refresh the eventgrid lib

* Revert changes

* Revert changes

* Update the new line

* Update the modular test cases

* Update the file name

* Resolve conflicts

* Remove the empty model validation logic

* Add UT to cover nullable constants

* Update the UT for anonymousModel.spec

* Regenerate OpenAI

* Update the cases

* Update the UTs in RLC

* Update the named empty model

* Refresh the event grid

* Resolve changes

* Update the UT for getModelInlineSigniture

* Update the comments

* Update the comments

* Upgrade the test cases

* Added the UTs for sample gen

* Update the non-empty anonymous model cases
  • Loading branch information
MaryGao authored Oct 25, 2023
1 parent 1de1945 commit d913c84
Show file tree
Hide file tree
Showing 27 changed files with 2,207 additions and 678 deletions.
154 changes: 73 additions & 81 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/autorest.typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
"@types/sinon": "^10.0.0",
"@types/xmlbuilder": "0.0.34",
"@types/yargs": "^17.0.10",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"autorest": "^3.4.2",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/rlc-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"chai": "^4.3.7",
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"eslint-plugin-require-extensions": "0.1.3",
"cross-env": "7.0.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/rlc-common/src/buildObjectTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,4 +484,4 @@ function generateForOutput(
(schemaUsage.includes(SchemaContext.Exception) &&
propertyUsage?.includes(SchemaContext.Exception))
);
}
}
4 changes: 4 additions & 0 deletions packages/rlc-common/src/helpers/valueGenerationUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ function mockUnionValues(
) {
const schema = schemaMap.get(type);
if (schema && schema.enum && schema.enum.length > 0) {
addToSchemaMap(schemaMap, schema.enum[0]);
return generateParameterTypeValue(
getAccurateTypeName(schema.enum[0]) ?? schema.enum[0],
parameterName,
Expand Down Expand Up @@ -242,6 +243,9 @@ function getAccurateTypeName(schema: Schema) {

function addToSchemaMap(schemaMap: Map<string, Schema>, schema: Schema) {
const type = getAccurateTypeName(schema);
if (!type) {
return;
}
if (
!schemaMap.has(type) &&
!["string", "number", "boolean"].includes(schema.type)
Expand Down
Loading

0 comments on commit d913c84

Please sign in to comment.