Skip to content

New DSL and Template Support #120

@ritch

Description

@ritch

Placeholder for now... some areas to flesh out in this issue:

  • new dsl examples, whats new whats the same (eg. properties, relations)
  • templates, what are they, how do they work
  • basic tooling examples

Here is a basic example to get something on paper... I'd assume everything about it will change. The purpose is to start a conversation:

DSL example

resources:
 - Account:
     controller:
       routes:
         - 'GET /summary/{accountNumber} => getSummary(accountNumber : string) => AccountSummary'
       dataSource: accountService
 - Customer:
      api: false
      dataSource: customerService
 - Transaction:
      api: false
      dataSource: transactionService
dataSources:
 - accountService:
   connector: swagger
   url: 'http://.../swagger.json'
 - customerService:
   connector: swagger
   url: 'http://.../swagger.json'
 - transactionService:
   connector: swagger
   url: 'http://.../swagger.json'

Template example

// resource template
function resourceTmpl(resource) {
  ensureFile(modelClassFilename(resource.name), MODEL_CLASS_TMPL, resource);
  ensureFile(controllerFilename(resources.name), CONTROLLER_CLASS_TMPL, resource);
  ensureFile(repositoryFilename(resource.name), REPO_CLASS_TMPL, resource);

  if (resource.dataSource !== false) {
    ensureFile(datasourceFilename(resource.name), DS_TMPL, resource);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions