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

wip: export schema dialog #5690

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

wip: export schema dialog #5690

wants to merge 4 commits into from

Conversation

mcasimir
Copy link
Collaborator

No description provided.

@mcasimir mcasimir added the poc label Apr 15, 2024
import type { Schema } from 'mongodb-schema';
import React, { useMemo, useState, useCallback } from 'react';

import { JSONEditor } from '@mongodb-js/compass-editor';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be declared as a dependency in package.json :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true

settings={
<>
<Checkbox
label="Include _id"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to highlight _id as code here?

Suggested change
label="Include _id"
label={<>Include <InlineCode>_id</InlineCode></>}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this applies for the other format as well)

MongoDB Validation Schema ($jsonSchema)
</Option>
<Option value="jsonSchema">JSON Schema (EJSON)</Option>
<Option value="internalSchema">Compass Internal Schema</Option>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're providing this for compatibility with the legacy feature that used this format until now? "Internal" sounds a bit like users aren't really supposed to rely on it :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point yeah, not sure what we could call that instead, or if we want to just drop it, maybe we can add an "x-samples: [...]" to the json schema and just get rid of this one

<Option value="mongodbJsonSchema">
MongoDB Validation Schema ($jsonSchema)
</Option>
<Option value="jsonSchema">JSON Schema (EJSON)</Option>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admittedly didn't understand what this meant until I looked at the source code, i.e. that this is the JSON schema for the EJSON representation of the BSON objects, kind of makes sense but maybe we can have a line below the Select to explain what the currently selected format actually means?

Copy link
Collaborator Author

@mcasimir mcasimir Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's probably a great idea yeah, awesome that you reviewed these changes! We probably want to rewrite this entire thing, but maybe i should try to rebase this one day, still better to start from something more or less "real"

mcasimir and others added 3 commits April 16, 2024 10:55
…hema-modal.tsx

Co-authored-by: Anna Henningsen <anna.henningsen@mongodb.com>
…hema-modal.tsx

Co-authored-by: Anna Henningsen <anna.henningsen@mongodb.com>
Co-authored-by: Anna Henningsen <anna.henningsen@mongodb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants