Skip to content

Commit

Permalink
updating test files and cases
Browse files Browse the repository at this point in the history
  • Loading branch information
RoshniNaveenaS committed Sep 10, 2024
1 parent 420e848 commit 9966b55
Show file tree
Hide file tree
Showing 5 changed files with 595 additions and 1,446 deletions.
179 changes: 49 additions & 130 deletions test/lib/compile/csdl2openapi.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,16 +494,9 @@ describe('Edge cases', function () {
{
title: "typeDefinitionOld",
type: "object",
properties: {
value: {
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": {
type: "string",
},
},
},
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": { type: "string" },
},
},
"JSON property old-style"
Expand All @@ -513,29 +506,22 @@ describe('Edge cases', function () {
{
title: "typeDefinitionNew",
type: "object",
properties: {
value: {
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": {
type: "string",
},
},
},
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": { type: "string" },
},
},
"JSON property new-style"
);
assert.deepStrictEqual(
openapi.components.schemas["jsonExamples.single"].properties.stream2,
{
maxLength: 10,
allOf: [
{ $ref: "#/components/schemas/jsonExamples.typeDefinitionNew" },
],
},
"MaxLength"
openapi.components.schemas["jsonExamples.single"].properties.stream2,
{
maxLength: 10,
allOf: [
{ $ref: "#/components/schemas/jsonExamples.typeDefinitionNew" },
],
},
"MaxLength"
);
})

Expand Down Expand Up @@ -579,41 +565,27 @@ describe('Edge cases', function () {
assert.deepStrictEqual(
openapi.components.schemas["jsonExamples.typeDefinitionOld"],
{
title: "typeDefinitionOld",
type: "object",
properties: {
value: {
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": {
type: "string"
}
}
}
}
title: "typeDefinitionOld",
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": { type: "string" },
},
},
"JSON property old-style"
);
assert.deepStrictEqual(
"JSON property old-style",
);
assert.deepStrictEqual(
openapi.components.schemas["jsonExamples.typeDefinitionNew"],
{
title: "typeDefinitionNew",
type: "object",
properties: {
value: {
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": {
type: "string"
}
}
}
}
title: "typeDefinitionNew",
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": { type: "string" },
},
},
"JSON property new-style"
);
"JSON property new-style",
);
})

it('no key', function () {
Expand Down Expand Up @@ -2226,77 +2198,24 @@ see [Expand](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-prot
assert.deepStrictEqual(
openapi.components.schemas["typeExamples.single"].properties,
{
"withMaxLength": {
"allOf": [
{
"$ref": "#/components/schemas/typeExamples.typeDefinitionNew"
}
],
"maxLength": 10
},
"binary": {
"type": "object",
"properties": {
"value": {
"type": "string",
"format": "base64url"
}
}
},
"primitive": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
}
]
}
}
},
"propertyPath": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"sbyte": {
"type": "object",
"properties": {
"value": {
"type": "integer",
"format": "int8"
}
}
},
"time": {
"type": "object",
"properties": {
"value": {
"type": "string",
"format": "time",
"example": "15:51:04"
}
}
},
"kaputt": {
"type": "object",
"properties": {
"value": {}
}
},
"unknown": {
"$ref": "#/components/schemas/typeExamples.un-known"
}
withMaxLength: {
maxLength: 10,
allOf: [
{ $ref: "#/components/schemas/typeExamples.typeDefinitionNew" },
],
},
binary: { format: "base64url", type: "string" },
primitive: {
anyOf: [{ type: "boolean" }, { type: "number" }, { type: "string" }],
},
propertyPath: { type: "string" },
sbyte: { type: "integer", format: "int8" },
time: { type: "string", format: "time", example: "15:51:04" },
kaputt: {},
unknown: {
$ref: "#/components/schemas/typeExamples.un-known",
},

},
"MaxLength"
);
Expand Down
Loading

0 comments on commit 9966b55

Please sign in to comment.