-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from boyney123/feat-description-and-maintainers
- Loading branch information
Showing
9 changed files
with
144 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,90 @@ | ||
export const generateContentForDetailType = ({ detailType, description = '', rulesForDetailType, schemaName, schemaVersion, descriptionsForProperties}) => { | ||
|
||
return `--- | ||
export const generateContentForDetailType = ({ | ||
detailType, | ||
description = '', | ||
rulesForDetailType, | ||
schemaName, | ||
schemaVersion, | ||
descriptionsForProperties, | ||
}) => { | ||
return `--- | ||
Title: ${detailType} | ||
--- | ||
${description} | ||
${descriptionsForProperties ? ` | ||
${ | ||
descriptionsForProperties | ||
? ` | ||
## Detail Definitions | ||
${Object.keys(descriptionsForProperties).map(rootKey => ` | ||
${Object.keys(descriptionsForProperties).map( | ||
(rootKey) => ` | ||
#### ${rootKey} | ||
${Object.keys(descriptionsForProperties[rootKey]).map(property => ` | ||
- \`${property}\` - ${descriptionsForProperties[rootKey][property]?.type} - ${descriptionsForProperties[rootKey][property].description}`)} | ||
`)}` : ''} | ||
${Object.keys(descriptionsForProperties[rootKey]).map( | ||
(property) => ` | ||
- \`${property}\` - ${descriptionsForProperties[rootKey][property]?.type} - ${descriptionsForProperties[rootKey][property].description}` | ||
)} | ||
` | ||
)}` | ||
: '' | ||
} | ||
<br /> | ||
${rulesForDetailType.length > 0 ? ` | ||
${ | ||
rulesForDetailType.length > 0 | ||
? ` | ||
## Event Rules | ||
${rulesForDetailType.map(rule => `- \`${rule}\``)} | ||
` : ''} | ||
${rulesForDetailType.map((rule) => `- \`${rule}\``)} | ||
` | ||
: '' | ||
} | ||
<br /> | ||
# **Schema details** | ||
#### Schema name: \`${schemaName}\` | ||
#### Version: \`${schemaVersion}\` | ||
`; | ||
` | ||
} | ||
|
||
|
||
export const generateSideNotesForDetailType = ({ schema, example }) => { | ||
return ` | ||
return ` | ||
${example ? ` | ||
${ | ||
example | ||
? ` | ||
#! Event Example | ||
\`\`\`json | ||
${JSON.stringify(example, null, 4)} | ||
\`\`\` | ||
` : ''} | ||
` | ||
: '' | ||
} | ||
#! Event Schema | ||
\`\`\`json | ||
${JSON.stringify(schema, null, 4)} | ||
\`\`\``; | ||
\`\`\`` | ||
} | ||
|
||
export const generateSourceMetadata = ({ source, sourceDescription }) => { | ||
return `--- | ||
export const generateSourceMetadata = ({ source, sourceDescription, maintainers }) => { | ||
return `--- | ||
Title: ${source} | ||
--- | ||
${sourceDescription}`; | ||
} | ||
${sourceDescription} | ||
${ | ||
maintainers.length > 0 | ||
? ` | ||
**Maintainers**: | ||
${maintainers.join(', ')} | ||
` | ||
: '' | ||
} | ||
` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters