-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dependencies, move things around, fix models and code issues
- Loading branch information
1 parent
28ba588
commit b1df65c
Showing
16 changed files
with
87 additions
and
116 deletions.
There are no files selected for viewing
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
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 |
---|---|---|
@@ -1,20 +1,34 @@ | ||
import { RestMethod } from "@common/enums"; | ||
import { ApiEndpoint } from "../../../models"; | ||
import Error400BadRequest from "../../errors/error-400-bad-request"; | ||
import { JSONValue } from "../../types"; | ||
import { JSONValue } from "@common/types"; | ||
|
||
export class SpecService { | ||
static async uploadNewSpec(specObject: JSONValue) { | ||
const hosts: string[] = []; | ||
const apiEndpoints: ApiEndpoint[] = []; | ||
const servers: any[] = specObject["servers"]; | ||
const paths: JSONValue = specObject["paths"]; | ||
|
||
if (!servers || servers?.length === 0) { | ||
throw new Error400BadRequest("No servers found in spec file."); | ||
} | ||
|
||
servers.forEach((server) => { | ||
if (server["url"]) { | ||
hosts.push(server["url"]); | ||
} | ||
}); | ||
|
||
const pathKeys = Object.keys(paths); | ||
pathKeys.forEach((path) => { | ||
const methods = Object.keys(paths[path]); | ||
methods.forEach((method) => { | ||
servers.forEach((server) => { | ||
if (server["url"]) { | ||
const methodEnum = method.toUpperCase() as RestMethod; | ||
const apiEndpoint = new ApiEndpoint(); | ||
apiEndpoint.path = path; | ||
apiEndpoint.method = methodEnum; | ||
apiEndpoint.host = server["url"]; | ||
} | ||
}); | ||
}) | ||
}) | ||
console.log(hosts); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -5,5 +5,8 @@ | |
"scripts": { | ||
"build": "tsc", | ||
"watch": "tsc -w" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^4.7.4" | ||
} | ||
} |
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
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,8 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
typescript@^4.7.4: | ||
version "4.7.4" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" | ||
integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== |