-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Insomnia Format v5 #8209
base: develop
Are you sure you want to change the base?
Insomnia Format v5 #8209
Conversation
cb41723
to
b24bbe8
Compare
b24bbe8
to
2ec7d17
Compare
packages/insomnia/package.json
Outdated
"yaml-source-map": "^2.1.1" | ||
"yaml-source-map": "^2.1.1", | ||
"zod": "^3.23.8", | ||
"zod-to-json-schema": "^3.23.3" |
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.
It seems that zod-to-json-schema is not used.
|
||
const apiSpecSchema = z.object({ | ||
type: z.literal('spec.insomnia.rest/5.0'), | ||
meta: MetaSchema.optional(), |
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.
Can use zod extend method to remove duplicate codes.
resources.push(requestGroup); | ||
|
||
walkCollection(item.children, requestGroup._id); | ||
} else if ('method' in item) { |
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.
I think that we need a type field to identity what entity it is.
function getCollectionFromResources(resources: (Request | RequestGroup | WebSocketRequest | GrpcRequest)[], parentId: string): Extract<InsomniaFile, { type: 'collection.insomnia.rest/5.0' }>['collection'] { | ||
const collection: Extract<InsomniaFile, { type: 'collection.insomnia.rest/5.0' }>['collection'] = []; | ||
|
||
resources.filter(resource => resource.parentId === parentId).forEach(resource => { |
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.
Can build the tree in O(n) time.
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.
Looks good to me.
46dc254
to
f76755b
Compare
d9a32a4
to
6124ada
Compare
Exploring the new v5 format: