-
Notifications
You must be signed in to change notification settings - Fork 188
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
base: main
Are you sure you want to change the base?
Conversation
packages/compass-schema/src/components/export-schema/export-schema-modal.tsx
Outdated
Show resolved
Hide resolved
packages/compass-schema/src/components/export-schema/export-schema-modal.tsx
Outdated
Show resolved
Hide resolved
import type { Schema } from 'mongodb-schema'; | ||
import React, { useMemo, useState, useCallback } from 'react'; | ||
|
||
import { JSONEditor } from '@mongodb-js/compass-editor'; |
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.
This needs to be declared as a dependency in package.json :)
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.
true
settings={ | ||
<> | ||
<Checkbox | ||
label="Include _id" |
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.
Would it make sense to highlight _id
as code here?
label="Include _id" | |
label={<>Include <InlineCode>_id</InlineCode></>} |
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.
(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> |
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.
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 :)
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.
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> |
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 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?
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.
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"
…hema-modal.tsx Co-authored-by: Anna Henningsen <[email protected]>
…hema-modal.tsx Co-authored-by: Anna Henningsen <[email protected]>
Co-authored-by: Anna Henningsen <[email protected]>
No description provided.