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

After Ejecting templates and customising, re-running dataverse-gen@v2 didn't pick up the new templates #30

Open
philcatterall opened this issue Dec 10, 2022 · 1 comment

Comments

@philcatterall
Copy link

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;
@philcatterall
Copy link
Author

|| just update the readme.md and the template.json file. I have done this and submitted a pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant