-
Notifications
You must be signed in to change notification settings - Fork 11
Add type check #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add type check #80
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7037365
Add typescript
daogrady 2f195af
Types for schema
daogrady 4c7e9a5
More types
daogrady 3e8f386
Add target restriction types
daogrady f579241
Fix remaining types
daogrady d1aba18
Add types in index.js
daogrady 3118ebb
Add workflow
daogrady 0d63275
Update lib/compile/csdl2openapi.js
daogrady 9ea65cb
Merge branch 'main' into feat/types
daogrady 02d2a34
Typo
daogrady 642d76d
Remove noUncheckedIndexAccess config
daogrady db68176
Merge branch 'main' into feat/types
daogrady eb89bc8
Remove obsolete typing
daogrady 63faeba
Remove obsolete ignore-error
daogrady File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| name: Type Check | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| jobs: | ||
| typecheck: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '24' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm i | ||
|
|
||
| - name: Run type check | ||
| run: npm run check:types |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -184,4 +184,5 @@ function _servicePath(csdl, csn, protocols) { | |
|
|
||
| return paths; | ||
| } | ||
| return {} | ||
| } | ||
This file contains hidden or 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,50 @@ | ||
| type StringSchema = { | ||
| type: 'string' | ||
| format?: 'base64url' | 'uuid' | 'time' | 'date' | 'date-time' | 'duration' | ||
| maxLength?: number | ||
| example?: string | ||
| pattern?: string | ||
| } | ||
|
|
||
| type NumberSchema = { | ||
| type: 'number' | 'integer' | ||
| format?: 'float' | 'double' | 'decimal' | 'uint8' | 'int8' | 'int16' | 'int32' | 'int64' | ||
| multipleOf?: number | ||
| example?: number, | ||
| minimum?: number | ||
| maximum?: number | ||
| exclusiveMinimum?: boolean | ||
| exclusiveMaximum?: boolean | ||
| } | ||
|
|
||
| type BooleanSchema = { | ||
| type: 'boolean' | ||
| } | ||
|
|
||
| type ArraySchema = { | ||
| type: 'array', | ||
| items: Schema | ||
| } | ||
|
|
||
| type Meta = { | ||
| nullable?: boolean | ||
| default?: unknown | ||
| example?: string | number, | ||
| description?: string | ||
| '$ref'?: unknown | ||
| } | ||
|
|
||
| type SingleSchema = (StringSchema | NumberSchema | BooleanSchema | ArraySchema) & Meta | ||
|
|
||
| type AnyOf = { anyOf: Schema[] } & Meta | ||
| type AllOf = { allOf: Schema[] } & Meta | ||
| type MultiSchema = AnyOf | AllOf | ||
|
|
||
| export type Schema = (SingleSchema | MultiSchema) | ||
|
|
||
|
|
||
|
|
||
| export type TargetRestrictions = { | ||
| Countable?: boolean | ||
| Expandable?: boolean | ||
| } | ||
This file contains hidden or 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 hidden or 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,31 @@ | ||
| { | ||
| // Visit https://aka.ms/tsconfig to read more about this file | ||
| "compilerOptions": { | ||
| "module": "nodenext", | ||
| "target": "esnext", | ||
| "lib": ["esnext"], | ||
| "types": ["node"], | ||
| "allowJs": true, | ||
| "checkJs": true, | ||
| "noUncheckedIndexedAccess": false, | ||
| "exactOptionalPropertyTypes": true, | ||
| "noImplicitOverride": true, | ||
| "noUnusedLocals": true, | ||
| "noUnusedParameters": true, | ||
| "noFallthroughCasesInSwitch": true, | ||
| "noPropertyAccessFromIndexSignature": true, | ||
| "strict": true, | ||
| "jsx": "react-jsx", | ||
| "verbatimModuleSyntax": true, | ||
| "isolatedModules": true, | ||
| "noUncheckedSideEffectImports": true, | ||
| "moduleDetection": "force", | ||
| "skipLibCheck": true, | ||
| // enable after first round | ||
| "noImplicitReturns": false, | ||
| "noImplicitAny": false, | ||
| }, | ||
| "exclude": [ | ||
| "**/*.test.js" | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful! 🤩