JSON/YAML Editor
Last updated
Last updated
While this page covers the JSON Mode of the Neurelo Schema Editor, you can also use the YAML Mode of the editor by selecting the "YAML Editor" instead of the "JSON Editor" in the mode selector
The JSON Editor mode in Neurelo is a feature for users who prefer to directly edit their schema as JSON for their database definitions. Here’s how you can navigate and use this mode:
Switching to JSON Editor Mode:
Select "JSON Editor" from the dropdown menu in the Schema Builder.
The dashboard will transition to display the JSON representation of your database schema.
Viewing and Editing JSON Schema as Code:
In this mode, you’ll see the schema in JSON format outlining your "objects," "enums," and "inner objects
The Neurelo JSON Editor adheres to standard JSON Schema structures, allowing for familiarity and ease of use.
Make any desired changes directly in the JSON code. This is ideal for users comfortable with JSON syntax and schema structures.
Committing Changes:
If you make edits in the JSON Editor (or any of the editor modes), the "Commit" button becomes active, enabling you to commit your changes.
Click "Commit" after making changes. The schema is validated and df there are no errors, your changes will be committed. If errors exist, they need to be resolved before committing.
Handling Errors:
If an error is detected before committing (e.g., changing "authors" to "author", when "authors" is also being referenced in other parts of the schema), a pop-up will notify you of the error, and the "Commit" button will be disabled.
To view and address these errors, click on "View Errors." This action will take you back to the editor, and a "Schema Errors" pane will open. The Schema Errors pane provides a detailed description of each error, allowing you to pinpoint and correct issues in your schema.
The JSON Editor mode in Neurelo offers a direct and flexible way to work with your database schema, catering to users who prefer hands-on control over their schema definitions by editing schema as JSON.
Neurelo’s JSON Editor includes a handy "Prettify" feature designed to enhance the readability and organization of your JSON code. This feature is especially useful for engineers and developers who work extensively with JSON structures. Here’s how to use it:
Locating the Prettify Icon:
In the JSON Editor, look for a set of icons near the editing area.
The icon for the Prettify feature typically resembles a magic wand or a similar symbol indicating formatting or beautification.
Applying the Prettify Feature:
Click on the Prettify icon (magic wand).
This action instantly formats your JSON code, organizing it into a more readable and structured format.
Benefits of Prettifying JSON Code:
The Prettify feature aids in enhancing the clarity of your code by adjusting indentation, aligning elements, and making the overall structure more visually appealing and easier to navigate.
It’s particularly beneficial when working with large or complex JSON schemas, as it helps in quickly identifying elements, properties, and values.
Using the Prettify feature in Neurelo's JSON Editor can significantly improve the efficiency of editing and reviewing JSON schemas, making the code maintenance process more streamlined and manageable.
Neurelo’s JSON Editor includes a useful "View Diff" feature that allows you to compare your current edits with the most recent commit. This is particularly useful for tracking modifications and ensuring accuracy in your changes. Here’s how to use this feature:
Locating the View Differences Icon:
In the JSON Editor, look for a set of icons, as indicated in the provided image.
Identify the icon for the View Difference feature, usually represented by a dot and arrow symbol, situated next to the Prettify icon.
Activating View Diff:
Click on the View Diff icon.
This action splits the editor into two sections: the left side displays the most recent commit, and the right side shows your modified version.
Understanding the Highlights and Indicators:
Light Color Highlight: Lines with changes are marked with a light color highlight, making it easy to spot where modifications have occurred.
Dark Color Highlight: Within those lines, specific words, values, or characters that have been altered are indicated with a darker shade. This feature pinpoints the exact changes made.
Blank Gray Space with Slant Lines: Any sections of code that have been completely removed are indicated with blank gray spaces featuring slant gray lines.
Comparing Changes Effectively:
The side-by-side comparison allows for an efficient review of changes, helping you to quickly identify additions, deletions, or modifications in the code.
This feature is particularly helpful in complex editing scenarios where multiple changes are made, ensuring that no unintended alterations go unnoticed.
The View Difference feature in Neurelo’s JSON Editor enhances your code editing experience by providing a clear and intuitive way to track and review changes made to your JSON schema.
After making changes to your schema JSON in Neurelo’s JSON Editor, it’s crucial to ensure that everything is correct before committing. The "Validate Schema" feature is designed to check your JSON schema for any errors or inconsistencies. Here’s how to use this feature:
Locating the Validate Schema Icon:
Refer to the provided image to locate the set of icons in the JSON Editor.
Find the "Validate Schema" icon, typically represented by a symbol indicative of checking or validation.
Initiating Schema Validation:
Click on the "Validate Schema" icon.
This action triggers an automatic validation process for your JSON schema.
Identifying and Handling Errors:
If there are any errors in your schema, a red toast notification will appear at the bottom of the editor stating, "The schema definition has x error(s)."
Next to this notification, you’ll find a "View Errors" button.
If the schema is valid, there will be a green notification toast at the bottom of the editor indicating that the schema is valid.
Viewing Detailed Errors:
Click on "View Errors" to open the "Schema Errors" pane.
This pane will display detailed information about each error, including its location and nature.
Correcting Errors Before Committing:
Use the information in the Schema Errors pane to correct any mistakes or inconsistencies in your JSON code.
Ensuring your schema is error-free before committing can save significant time and effort and prevent issues in your project down the line.
Even if you miss doing this step, Neurelo will validate the schema when you are performing the commit for your changes.
The Validate Schema feature in Neurelo’s JSON Editor is a valuable tool for maintaining the integrity and accuracy of your project’s schema, helping you to identify and rectify errors before they impact your project.
The "Introspect" feature in Neurelo synchronizes your Neurelo schema definitions with the current state of your source database. This feature is essential for ensuring that schema changes in your database are accurately reflected in Neurelo. Here’s how to use it:
Locating the Introspect Icon:
Refer to the provided image to locate the Introspect icon in the Neurelo interface.
Initiating Introspection:
Click on the "Introspect" icon to start the synchronization process.
A popup will appear, presenting you with a Data Source dropdown list. This list includes all databases added to your project.
Selecting Your Data Source:
From the dropdown, select the database you wish to synchronize with.
If you need to add a new data source, you’ll find an option for "New Data Source" as well.
Starting the Introspection Process:
After selecting the desired database, click "Start" to initiate the introspection.
A notification will inform you that "Introspection is in progress." This process will typically complete in a few seconds.
Reviewing Schema Changes:
Once introspection is complete, you’ll see a screen displaying the differences between your current schema in Neurelo and schema definition in the selected database. You can review the differences and make any necessary adjustments.
You have the option to "Cancel" if you do not wish to continue with the differences, or "Continue" if you want to update your schema in Neurelo.
Updating Your Schema:
Clicking "Continue" will create a new commit and update your current Neurelo schema with the latest information fetched from your original database.
This action ensures that your Neurelo project remains up-to-date and aligned with your source database.
The "Reset to Last Commit" feature in Neurelo reverts their schema edits back to the state of the most recent commit. Here’s how to use this feature:
Locating the Reset to Last Commit Button:
Find the "Reset to Last Commit" button in the Neurelo interface. It is typically located next to the "Introspect" tool, forming part of the array of schema editor options.
Initiating the Reset:
Click on the "Reset to Last Commit" button.
This action will instantly revert all your current unsaved changes in the schema back to the state of the last committed version.
Confirming the Reset Action:
Depending on Neurelo’s interface, you might receive a prompt asking for confirmation to proceed with the reset. This is to ensure that you are aware of the changes being reversed.
Confirm the action if prompted, to complete the reset process.
Effects of the Reset:
Once you reset to the last commit, any changes or edits made to the schema in the editor will be discarded and the last commited version will be loaded in the editor.
This feature is particularly useful when the changes made are extensive and rolling back manually would be time-consuming or complex.
The "Reset to Last Commit" feature is a useful component of Neurelo's schema editing tools, providing a quick way to revert to a previous stable state of your schema, thereby safeguarding against unintended modifications or errors.