-
Notifications
You must be signed in to change notification settings - Fork 737
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle circular dependency in additionalProperties (#3819)
- Loading branch information
1 parent
8e30959
commit e765f8b
Showing
4 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
common/changes/@autorest/modelerfour/fix-additional-props-circular-dep_2021-01-29-18-24.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@autorest/modelerfour", | ||
"comment": "Fix the use of circular dependencies in additionalProperties [PR #3819](https://github.com/Azure/autorest/pull/3819)", | ||
"type": "patch" | ||
} | ||
], | ||
"packageName": "@autorest/modelerfour", | ||
"email": "tiguerin@microsoft.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/extensions/modelerfour/test/modeler/modelerfour.schemas.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { addOperation, addSchema, createTestSpec } from "../utils"; | ||
import { runModeler } from "./modelerfour-utils"; | ||
|
||
describe("Modelerfour.Schemas", () => { | ||
describe("additionalProperties", () => { | ||
it("support reference to itself(circular dependency", async () => { | ||
const spec = createTestSpec(); | ||
|
||
addSchema(spec, "SelfRefSchema", { | ||
additionalProperties: { | ||
$ref: "#/components/schemas/SelfRefSchema", | ||
}, | ||
}); | ||
|
||
const codeModel = await runModeler(spec); | ||
|
||
const schema = codeModel.schemas.dictionaries?.[0]; | ||
expect(schema).not.toBeNull(); | ||
expect(schema?.language.default.name).toEqual("SelfRefSchema"); | ||
expect(schema?.elementType).toEqual(schema); | ||
}); | ||
}); | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/extensions/modelerfour/test/modeler/modelerfour.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters