Skip to content

Commit 3343725

Browse files
committed
Initial commit
0 parents  commit 3343725

File tree

14 files changed

+8147
-0
lines changed

14 files changed

+8147
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
dist
3+
node_modules
4+
yarn.lock

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 100,
3+
"singleQuote": true,
4+
"trailingComma": "es5"
5+
}

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ⚛️ swagger-to-graphql
2+
3+
Node client for generating crude GraphQL specs from Swagger OpenAPI.
4+
Currently only supports Swagger v2.
5+
6+
## Usage
7+
8+
```
9+
npm i --save-dev @manifoldco/swagger-to-graphql
10+
```
11+
12+
See the [generate.js](./scripts/generate.js) script for an example of how to
13+
load files.
14+
15+
## Notes
16+
17+
GraphQL is a spec, just like OpenAPI. For this reason, automatic generation
18+
isn’t ideal long-term. This library should probably be used as a
19+
**first-pass** to migrate an OpenAPI endpoint to GraphQL. This can generate
20+
types, but can’t intelligently generate the best queries and mutations for
21+
your specific endpoint.
22+
23+
A common example of this: Swagger has a concept of `format: datetime`.
24+
GraphQL cares about this, but doesn’t assume the formatting. Is this UNIX
25+
time? ISO? Are there timezones? Types can be so much more descriptive than
26+
mere `string` or `int`, and GraphQL gives you the tools to declare this
27+
yourself.

jest.config.js

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
module.exports = {
5+
// All imported modules in your tests should be mocked automatically
6+
// automock: false,
7+
8+
// Stop running tests after the first failure
9+
// bail: false,
10+
11+
// Respect "browser" field in package.json when resolving modules
12+
// browser: false,
13+
14+
// The directory where Jest should store its cached dependency information
15+
// cacheDirectory: "/var/folders/cb/jmpdtwj56mj1fyyct_6rxqb00000gn/T/jest_dx",
16+
17+
// Automatically clear mock calls and instances between every test
18+
clearMocks: true,
19+
20+
// Indicates whether the coverage information should be collected while executing the test
21+
// collectCoverage: false,
22+
23+
// An array of glob patterns indicating a set of files for which coverage information should be collected
24+
// collectCoverageFrom: [
25+
// "src/**/*.{js,jsx,ts,tsx}",
26+
// ],
27+
28+
// The directory where Jest should output its coverage files
29+
coverageDirectory: "coverage",
30+
31+
// An array of regexp pattern strings used to skip coverage collection
32+
// coveragePathIgnorePatterns: [
33+
// "/node_modules/"
34+
// ],
35+
36+
// A list of reporter names that Jest uses when writing coverage reports
37+
// coverageReporters: [
38+
// "json",
39+
// "text",
40+
// "lcov",
41+
// "clover"
42+
// ],
43+
44+
// An object that configures minimum threshold enforcement for coverage results
45+
// coverageThreshold: null,
46+
47+
// Make calling deprecated APIs throw helpful error messages
48+
// errorOnDeprecated: false,
49+
50+
// Force coverage collection from ignored files usin a array of glob patterns
51+
// forceCoverageMatch: [],
52+
53+
// A path to a module which exports an async function that is triggered once before all test suites
54+
// globalSetup: null,
55+
56+
// A path to a module which exports an async function that is triggered once after all test suites
57+
// globalTeardown: null,
58+
59+
// A set of global variables that need to be available in all test environments
60+
globals: {
61+
"ts-jest": {
62+
tsConfig: "tsconfig.json"
63+
}
64+
},
65+
66+
// An array of directory names to be searched recursively up from the requiring module's location
67+
moduleDirectories: ["node_modules", "src"],
68+
69+
// An array of file extensions your modules use
70+
moduleFileExtensions: ["ts", "tsx", "js"],
71+
72+
// A map from regular expressions to module names that allow to stub out resources with a single module
73+
// moduleNameMapper: {},
74+
75+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
76+
// modulePathIgnorePatterns: [],
77+
78+
// Activates notifications for test results
79+
// notify: false,
80+
81+
// An enum that specifies notification mode. Requires { notify: true }
82+
// notifyMode: "always",
83+
84+
// A preset that is used as a base for Jest's configuration
85+
// preset: null,
86+
87+
// Run tests from one or more projects
88+
// projects: null,
89+
90+
// Use this configuration option to add custom reporters to Jest
91+
// reporters: undefined,
92+
93+
// Automatically reset mock state between every test
94+
// resetMocks: false,
95+
96+
// Reset the module registry before running each individual test
97+
// resetModules: false,
98+
99+
// A path to a custom resolver
100+
// resolver: null,
101+
102+
// Automatically restore mock state between every test
103+
// restoreMocks: false,
104+
105+
// The root directory that Jest should scan for tests and modules within
106+
// rootDir: null,
107+
108+
// A list of paths to directories that Jest should use to search for files in
109+
// roots: [
110+
// "<rootDir>"
111+
// ],
112+
113+
// Allows you to use a custom runner instead of Jest's default test runner
114+
// runner: "jest-runner",
115+
116+
// The paths to modules that run some code to configure or set up the testing environment before each test
117+
// setupFiles: [],
118+
119+
// The path to a module that runs some code to configure or set up the testing framework before each test
120+
// setupTestFrameworkScriptFile: "<rootDir>/setupTests",
121+
122+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
123+
// snapshotSerializers: [],
124+
125+
// The test environment that will be used for testing
126+
// testEnvironment: "jest-environment-jsdom",
127+
128+
// Options that will be passed to the testEnvironment
129+
// testEnvironmentOptions: {},
130+
131+
// Adds a location field to test results
132+
// testLocationInResults: false,
133+
134+
// The glob patterns Jest uses to detect test files
135+
testMatch: ["**/tests/*.+(ts|tsx|js)"],
136+
137+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
138+
// testPathIgnorePatterns: [
139+
// "/node_modules/"
140+
// ],
141+
142+
// The regexp pattern Jest uses to detect test files
143+
// testRegex: "",
144+
145+
// This option allows the use of a custom results processor
146+
// testResultsProcessor: null,
147+
148+
// This option allows use of a custom test runner
149+
// testRunner: "jasmine2",
150+
151+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
152+
// testURL: "http://localhost",
153+
154+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
155+
// timers: "real",
156+
157+
// A map from regular expressions to paths to transformers
158+
transform: {
159+
"^.+\\.(ts|tsx)$": "ts-jest"
160+
}
161+
162+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
163+
// transformIgnorePatterns: [
164+
// "/node_modules/"
165+
// ],
166+
167+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
168+
// unmockedModulePathPatterns: undefined,
169+
170+
// Indicates whether each individual test should be reported during the run
171+
// verbose: null,
172+
173+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
174+
// watchPathIgnorePatterns: [],
175+
176+
// Whether to use watchman for file crawling
177+
// watchman: true,
178+
};

0 commit comments

Comments
 (0)