Skip to content

Commit

Permalink
feat: support keyof type
Browse files Browse the repository at this point in the history
  • Loading branch information
plantain-00 committed Jan 5, 2022
1 parent 5c85a8d commit 7ef7a0d
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 90 deletions.
1 change: 1 addition & 0 deletions demo/cases.gql
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ type EntryType {
template3: String!
template4: String!
template5: String!
keyof: String!
}

type Mutation {
Expand Down
10 changes: 9 additions & 1 deletion demo/cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@
"template5": {
"type": "string",
"pattern": "^\\/api\\/users\\?isAdmin=true|false$"
},
"keyof": {
"type": "string",
"enum": [
"member1",
"member2"
]
}
},
"required": [
Expand Down Expand Up @@ -186,7 +193,8 @@
"template2",
"template3",
"template4",
"template5"
"template5",
"keyof"
],
"additionalProperties": true
},
Expand Down
1 change: 1 addition & 0 deletions demo/cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ Field | Required | Type | Description
`template3` | `true` | ``/api/users/${number}`` |
`template4` | `true` | ``https://${string}.${"png" | "jpg"}`` |
`template5` | `true` | ``/api/users?isAdmin=${boolean}`` |
`keyof` | `true` | `"member1" | "member2"` |

## `Mutation`

Expand Down
1 change: 1 addition & 0 deletions demo/cases.ml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ type entryType = {
template3: string;
template4: string;
template5: string;
keyof: string;
}

type mutation = {
Expand Down
5 changes: 5 additions & 0 deletions demo/cases.mongoose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,11 @@ export const entryTypeSchema = {
type: String,
required: true
},
keyof: {
type: Schema.Types.Mixed,
required: true,
enum: ["member1", "member2"]
},
}

export const mutationSchema = {
Expand Down
1 change: 1 addition & 0 deletions demo/cases.proto
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ message EntryType {
string template3 = 33;
string template4 = 34;
string template5 = 35;
string keyof = 36;
}

message Mutation {
Expand Down
1 change: 1 addition & 0 deletions demo/cases.re
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ type entryType = {
template3: string,
template4: string,
template5: string,
keyof: string,
};

type mutation = {
Expand Down
1 change: 1 addition & 0 deletions demo/cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ pub struct EntryType {
#[serde(rename = "template3")] pub template_3: String,
#[serde(rename = "template4")] pub template_4: String,
#[serde(rename = "template5")] pub template_5: String,
pub keyof: String,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down
1 change: 1 addition & 0 deletions demo/cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ export type EntryType = {
template3: `/api/users/${number}`
template4: `https://${string}.${'png' | 'jpg'}`
template5: `/api/users?isAdmin=${boolean}`
keyof: keyof CreateInput2
}

export interface Mutation {
Expand Down

0 comments on commit 7ef7a0d

Please sign in to comment.