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

fix: static import schema help #721

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions messages/tree.import.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,14 @@ Display schema information for the --plan configuration file to stdout; if you s
- Import records using a plan definition file into your default org:

<%= config.bin %> <%= command.id %> --plan Account-Contact-plan.json

# schema-help

schema(array) - Data Import Plan: Schema for SFDX Toolbelt's data import plan JSON.

- items(object) - SObject Type: Definition of records to be insert per SObject Type
- sobject(string) - Name of SObject: Child file references must have SObject roots of this type
- saveRefs(boolean) - Save References: Post-save, save references (Name/ID) to be used for reference replacement in subsequent saves. Applies to all data files for this SObject type.
- resolveRefs(boolean) - Resolve References: Pre-save, replace @<reference> with ID from previous save. Applies to all data files for this SObject type.
- files(array) - Files: An array of files paths to load
- items(string|object) - Filepath: Filepath string or object to point to a JSON or XML file having data defined in SObject Tree format.
2 changes: 1 addition & 1 deletion schema/dataImportPlanSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"title": "Data Import Plan",
"description": "Schema for SFDX Toolbelt's data import plan JSON.",
"description": "Schema for data import plan JSON.",
"items": {
"type": "object",
"title": "SObject Type",
Expand Down
7 changes: 2 additions & 5 deletions src/commands/data/import/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { Logger, Messages, SchemaPrinter } from '@salesforce/core';
import { Messages } from '@salesforce/core';
import { getString, JsonMap } from '@salesforce/ts-types';
import { SfCommand, Flags, arrayWithDeprecation } from '@salesforce/sf-plugins-core';
import { ImportApi, ImportConfig } from '../../../api/data/tree/importApi';
Expand Down Expand Up @@ -61,7 +61,6 @@ export default class Import extends SfCommand<ImportResult[] | JsonMap> {

public async run(): Promise<ImportResult[] | JsonMap> {
const { flags } = await this.parse(Import);
const logger = await Logger.child('Import');
const importApi = new ImportApi(
flags['target-org'],
this.config.bin,
Expand All @@ -71,9 +70,7 @@ export default class Import extends SfCommand<ImportResult[] | JsonMap> {
if (flags['config-help']) {
// Display config help and return
const schema = importApi.getSchema();
if (!this.jsonEnabled()) {
new SchemaPrinter(logger, schema).getLines().forEach((line) => this.log(line));
}
this.log(messages.getMessage('schema-help'));

return schema;
}
Expand Down