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

Open
wants to merge 23 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

Closes INS-4397

@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.

@gatzjames gatzjames force-pushed the feature/ins-4397-spike-propose-new-formats-for-our-v5-specification branch 3 times, most recently from d9a32a4 to 6124ada Compare January 7, 2025 15:37
@gatzjames gatzjames force-pushed the feature/ins-4397-spike-propose-new-formats-for-our-v5-specification branch from a8e67bf to dceb1c3 Compare January 14, 2025 14:18
@gatzjames gatzjames self-assigned this Jan 16, 2025
@gatzjames gatzjames force-pushed the feature/ins-4397-spike-propose-new-formats-for-our-v5-specification branch from 767dadc to 4bb0640 Compare January 16, 2025 14:28
@gatzjames gatzjames marked this pull request as ready for review January 16, 2025 14:28
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