dataverse-gen
dataverse-gen copied to clipboard
After Ejecting templates and customising, re-running dataverse-gen@v2 didn't pick up the new templates
After some detective work, I found that .dataverse-gen.json didn't contain a property for output.templateRoot. Adding this property solves it. I then did a bit more digging in the repo and I think to solve this in the package, the .dataverse-gen.template.json file should have content something like this:
{
"entities":[],
"actions":[],
"functions":[],
"generateIndex": true,
"generateFormContext": false,
"generateEntityTypes": true,
"output": {
"useCache": false,
"outputRoot": "./src/dataverse-gen",
"templateRoot": "./_templates",
"fileSuffix": ".ts"
}
}
However, there may be more to it than this, as there are some other things going on, which I don't fully understand yet . In MetadataGeneratorConfig.ts the interfaces look correct. There is an object exported (see below) but I haven't figured out how it is used, beyond that it's referenced in TypescriptGenerator.ts. Maybe @scottdurow you could elaborate (if its relevant). I'm not sufficiently confident yet to submit this as a pull request, though if someone agrees that this is all that's needed, I will happily do so.
export const defaultOptions = {
entities: [],
actions: [],
functions: [],
referencedTypes: {
Object: {
name: "ObjectValue",
},
Guid: {
name: "Guid",
import: "dataverse-ify",
},
Entity: {
name: "IEntity",
import: "dataverse-ify",
},
EntityReference: {
name: "EntityReference",
import: "dataverse-ify",
},
WebApiExecuteRequest: {
name: "WebApiExecuteRequest",
import: "dataverse-ify",
},
StructuralProperty: {
name: "StructuralProperty",
import: "dataverse-ify",
},
OperationType: {
name: "OperationType",
import: "dataverse-ify",
},
ActivityParty: {
name: "ActivityParty",
import: "dataverse-ify",
},
enums: {
import: "../enums/",
},
complexTypes: {
import: "../complextypes/",
},
entityTypes: {
import: "../entities/",
},
},
generateIndex: true,
generateFormContext: false,
generateEntityTypes: true,
output: {
useCache: false,
outputRoot: "./src/dataverse-gen", // Default
templateRoot: "./_templates",
fileSuffix: ".ts",
},
} as DataverseGenOptions;
|| just update the readme.md and the template.json file. I have done this and submitted a pull request