Skip to content
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

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

gatzjames
Copy link
Contributor

@gatzjames gatzjames commented Nov 27, 2024

Exploring the new v5 format:

  • Import
  • Export
  • Updated e2e test suite with the new format

@gatzjames gatzjames force-pushed the feature/ins-4397-spike-propose-new-formats-for-our-v5-specification branch from cb41723 to b24bbe8 Compare November 27, 2024 18:26
@gatzjames gatzjames force-pushed the feature/ins-4397-spike-propose-new-formats-for-our-v5-specification branch from b24bbe8 to 2ec7d17 Compare December 6, 2024 10:20
"yaml-source-map": "^2.1.1"
"yaml-source-map": "^2.1.1",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.23.3"
Copy link
Contributor

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(),
Copy link
Contributor

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) {
Copy link
Contributor

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 => {
Copy link
Contributor

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.

Copy link
Contributor

@yaoweiprc yaoweiprc left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants