From 0795a9a9f31d554a5e2726705dfcc7a865395cda Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Mon, 7 Feb 2022 15:44:35 -0800 Subject: [PATCH 1/2] Rename LLC to DPG --- src/api/mock-api-router.ts | 2 +- src/reporter/coverage.ts | 2 +- src/test-routes/llc/customization.ts | 2 +- src/test-routes/llc/update.ts | 18 ++++++------- swagger/llc-customization.json | 40 ++++++++++++++++++++-------- swagger/llc_initial.json | 26 ++++++++++++------ swagger/llc_update1.json | 27 +++++++++++++------ 7 files changed, 78 insertions(+), 39 deletions(-) diff --git a/src/api/mock-api-router.ts b/src/api/mock-api-router.ts index eb322bf9..a3a184d6 100644 --- a/src/api/mock-api-router.ts +++ b/src/api/mock-api-router.ts @@ -7,7 +7,7 @@ import { MockRequestHandler, processRequest } from "./request-processor"; export type HttpMethod = "get" | "post" | "put" | "patch" | "delete" | "head"; -export type Category = "vanilla" | "azure" | "llc" | "optional"; +export type Category = "vanilla" | "azure" | "dpg" | "optional"; export class MockApiRouter { public router: Router; diff --git a/src/reporter/coverage.ts b/src/reporter/coverage.ts index de75612d..3ace6871 100644 --- a/src/reporter/coverage.ts +++ b/src/reporter/coverage.ts @@ -25,7 +25,7 @@ async function collectCoverage(coverageFolder: string) { General: getMergedReport("vanilla"), Azure: getMergedReport("azure"), Optional: getMergedReport("optional"), - LLC: getMergedReport("llc"), + DPG: getMergedReport("dpg"), }; if (Object.keys(report).every((cat) => Object.keys(report[cat]).length === 0)) { diff --git a/src/test-routes/llc/customization.ts b/src/test-routes/llc/customization.ts index 9d88c3ea..765dc160 100644 --- a/src/test-routes/llc/customization.ts +++ b/src/test-routes/llc/customization.ts @@ -1,6 +1,6 @@ import { app, json } from "../../api"; -app.category("llc", () => { +app.category("dpg", () => { app.get("/customization/model/raw", "GetRawModel", (req) => { return { status: 200, diff --git a/src/test-routes/llc/update.ts b/src/test-routes/llc/update.ts index 3525b683..3efe6b6f 100644 --- a/src/test-routes/llc/update.ts +++ b/src/test-routes/llc/update.ts @@ -1,39 +1,39 @@ import { app, json, ValidationError } from "../../api"; import { coverageService } from "../../services"; -app.category("llc", () => { - app.get("/servicedriven/parameters", "LLCAddOptionalInput", (req) => { +app.category("dpg", () => { + app.get("/servicedriven/parameters", "DPGAddOptionalInput", (req) => { return { status: 200, body: json({ message: `An object was successfully returned` }), }; }); - coverageService.register("llc", "LLCNewBodyType.JSON"); - coverageService.register("llc", "LLCNewBodyType.JPEG"); + coverageService.register("dpg", "DPGNewBodyType.JSON"); + coverageService.register("dpg", "DPGNewBodyType.JPEG"); - app.post("/servicedriven/parameters", "LLCNewBodyType", (req) => { + app.post("/servicedriven/parameters", "DPGNewBodyType", (req) => { switch (req.headers["content-type"]) { case "image/jpeg": // req.expect.rawBodyEquals("binary"); - coverageService.track("llc", "LLCNewBodyType.JPEG"); + coverageService.track("dpg", "DPGNewBodyType.JPEG"); return { status: 200 }; case "application/json": req.expect.bodyEquals({ url: "http://example.org/myimage.jpeg" }); - coverageService.track("llc", "LLCNewBodyType.JSON"); + coverageService.track("dpg", "DPGNewBodyType.JSON"); return { status: 200 }; default: throw new ValidationError("Should be image/jpeg or application/json", {}, req.headers["content-type"]); } }); - app.delete("/servicedriven/parameters", "LLCAddNewOperation", (req) => { + app.delete("/servicedriven/parameters", "DPGAddNewOperation", (req) => { return { status: 204, }; }); - app.get("/servicedriven/newpath", "LLCAddNewPath", (req) => { + app.get("/servicedriven/newpath", "DPGAddNewPath", (req) => { return { status: 200, body: json({ message: `An object was successfully returned` }), diff --git a/swagger/llc-customization.json b/swagger/llc-customization.json index 34f944b1..e07bd4bc 100644 --- a/swagger/llc-customization.json +++ b/swagger/llc-customization.json @@ -2,12 +2,16 @@ "swagger": "2.0", "info": { "version": "1.0.0", - "title": "LLCClient", - "description": "LLC Swagger that tests our ability to grow up." + "title": "DPGClient", + "description": "DPG Swagger that tests our ability to grow up." }, "host": "localhost:3000", - "schemes": ["http"], - "produces": ["application/json"], + "schemes": [ + "http" + ], + "produces": [ + "application/json" + ], "paths": { "/customization/model/{mode}": { "get": { @@ -38,7 +42,9 @@ "name": "input", "in": "body", "description": "Please put {'hello': 'world!'}", - "schema": { "$ref": "#/definitions/Input" }, + "schema": { + "$ref": "#/definitions/Input" + }, "required": true } ], @@ -54,7 +60,10 @@ }, "/customization/paging/{mode}": { "get": { - "x-ms-pageable": { "nextLinkName": "nextLink", "itemName": "values" }, + "x-ms-pageable": { + "nextLinkName": "nextLink", + "itemName": "values" + }, "operationId": "getPages", "description": "Get pages that you will either return to users in pages of raw bodies, or pages of models following growup.", "parameters": [ @@ -121,17 +130,24 @@ }, "Product": { "type": "object", - "required": ["received"], + "required": [ + "received" + ], "properties": { "received": { "type": "string", - "enum": ["raw", "model"] + "enum": [ + "raw", + "model" + ] } } }, "Input": { "type": "object", - "required": ["hello"], + "required": [ + "hello" + ], "properties": { "hello": { "type": "string" @@ -140,7 +156,9 @@ }, "LROProduct": { "type": "object", - "required": ["provisioningState"], + "required": [ + "provisioningState" + ], "allOf": [ { "$ref": "#/definitions/Product" @@ -153,4 +171,4 @@ } } } -} +} \ No newline at end of file diff --git a/swagger/llc_initial.json b/swagger/llc_initial.json index 06c43b55..60d335d3 100644 --- a/swagger/llc_initial.json +++ b/swagger/llc_initial.json @@ -2,13 +2,19 @@ "swagger": "2.0", "info": { "version": "1.0.0", - "title": "LLCClient", - "description": "LLC Swagger, this is the initial swagger a service could do" + "title": "DPGClient", + "description": "DPG Swagger, this is the initial swagger a service could do" }, "host": "localhost:3000", - "schemes": ["http"], - "produces": ["application/json"], - "consumes": ["application/json"], + "schemes": [ + "http" + ], + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], "paths": { "/serviceDriven/parameters": { "head": { @@ -80,7 +86,9 @@ "name": "parameter", "in": "body", "description": "I am a body parameter. My only valid JSON entry is { url: \"http://example.org/myimage.jpeg\" }", - "schema": { "$ref": "#/definitions/PostInput" }, + "schema": { + "$ref": "#/definitions/PostInput" + }, "required": true } ], @@ -120,7 +128,9 @@ "definitions": { "PostInput": { "type": "object", - "required": ["url"], + "required": [ + "url" + ], "properties": { "url": { "type": "string" @@ -128,4 +138,4 @@ } } } -} +} \ No newline at end of file diff --git a/swagger/llc_update1.json b/swagger/llc_update1.json index 420e8fb8..0443a442 100644 --- a/swagger/llc_update1.json +++ b/swagger/llc_update1.json @@ -2,12 +2,16 @@ "swagger": "2.0", "info": { "version": "1.0.0", - "title": "LLCClient", - "description": "LLC Swagger, this is the initial swagger a service could do" + "title": "DPGClient", + "description": "DPG Swagger, this is the initial swagger a service could do" }, "host": "localhost:3000", - "schemes": ["http"], - "produces": ["application/json"], + "schemes": [ + "http" + ], + "produces": [ + "application/json" + ], "paths": { "/serviceDriven/parameters": { "head": { @@ -93,13 +97,18 @@ "post": { "operationId": "params_postParameters", "description": "POST a JSON or a JPEG", - "consumes": ["application/json", "image/jpeg"], + "consumes": [ + "application/json", + "image/jpeg" + ], "parameters": [ { "name": "parameter", "in": "body", "description": "I am a body parameter with a new content type. My only valid JSON entry is { url: \"http://example.org/myimage.jpeg\" }", - "schema": { "$ref": "#/definitions/PostInput" }, + "schema": { + "$ref": "#/definitions/PostInput" + }, "required": true } ], @@ -170,7 +179,9 @@ "definitions": { "PostInput": { "type": "object", - "required": ["url"], + "required": [ + "url" + ], "properties": { "url": { "type": "string" @@ -178,4 +189,4 @@ } } } -} +} \ No newline at end of file From 91ae3d0c9d2222c6945400bc696d9df37becc5c5 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Thu, 10 Feb 2022 14:51:39 -0800 Subject: [PATCH 2/2] Prettier --- swagger/llc-customization.json | 27 +++++++-------------------- swagger/llc_initial.json | 18 +++++------------- swagger/llc_update1.json | 19 +++++-------------- 3 files changed, 17 insertions(+), 47 deletions(-) diff --git a/swagger/llc-customization.json b/swagger/llc-customization.json index e07bd4bc..70fea118 100644 --- a/swagger/llc-customization.json +++ b/swagger/llc-customization.json @@ -6,12 +6,8 @@ "description": "DPG Swagger that tests our ability to grow up." }, "host": "localhost:3000", - "schemes": [ - "http" - ], - "produces": [ - "application/json" - ], + "schemes": ["http"], + "produces": ["application/json"], "paths": { "/customization/model/{mode}": { "get": { @@ -130,24 +126,17 @@ }, "Product": { "type": "object", - "required": [ - "received" - ], + "required": ["received"], "properties": { "received": { "type": "string", - "enum": [ - "raw", - "model" - ] + "enum": ["raw", "model"] } } }, "Input": { "type": "object", - "required": [ - "hello" - ], + "required": ["hello"], "properties": { "hello": { "type": "string" @@ -156,9 +145,7 @@ }, "LROProduct": { "type": "object", - "required": [ - "provisioningState" - ], + "required": ["provisioningState"], "allOf": [ { "$ref": "#/definitions/Product" @@ -171,4 +158,4 @@ } } } -} \ No newline at end of file +} diff --git a/swagger/llc_initial.json b/swagger/llc_initial.json index 60d335d3..3935e677 100644 --- a/swagger/llc_initial.json +++ b/swagger/llc_initial.json @@ -6,15 +6,9 @@ "description": "DPG Swagger, this is the initial swagger a service could do" }, "host": "localhost:3000", - "schemes": [ - "http" - ], - "produces": [ - "application/json" - ], - "consumes": [ - "application/json" - ], + "schemes": ["http"], + "produces": ["application/json"], + "consumes": ["application/json"], "paths": { "/serviceDriven/parameters": { "head": { @@ -128,9 +122,7 @@ "definitions": { "PostInput": { "type": "object", - "required": [ - "url" - ], + "required": ["url"], "properties": { "url": { "type": "string" @@ -138,4 +130,4 @@ } } } -} \ No newline at end of file +} diff --git a/swagger/llc_update1.json b/swagger/llc_update1.json index 0443a442..23412273 100644 --- a/swagger/llc_update1.json +++ b/swagger/llc_update1.json @@ -6,12 +6,8 @@ "description": "DPG Swagger, this is the initial swagger a service could do" }, "host": "localhost:3000", - "schemes": [ - "http" - ], - "produces": [ - "application/json" - ], + "schemes": ["http"], + "produces": ["application/json"], "paths": { "/serviceDriven/parameters": { "head": { @@ -97,10 +93,7 @@ "post": { "operationId": "params_postParameters", "description": "POST a JSON or a JPEG", - "consumes": [ - "application/json", - "image/jpeg" - ], + "consumes": ["application/json", "image/jpeg"], "parameters": [ { "name": "parameter", @@ -179,9 +172,7 @@ "definitions": { "PostInput": { "type": "object", - "required": [ - "url" - ], + "required": ["url"], "properties": { "url": { "type": "string" @@ -189,4 +180,4 @@ } } } -} \ No newline at end of file +}