Uploaded image for project: 'mod-template-engine'
  1. mod-template-engine
  2. MODTEMPENG-2

Add template processing component

    XMLWordPrintable

Details

    • EPAM-Veg Sprint 1, EPAM-Veg Sprint 2
    • 5
    • Vega

    Description

      Component should have availability of template processing using context into result output. This functionality should be used by REST API of module. So we could call module and say: we need html\text\doc from this(id) template by using this entities as context.
      This component should be placed at mod-template-engine.

      Steps

      • Add new endpoint
      • Add template processing component as independent part of mod-template-engine
      • Resolver interface, which gets implemented for mustache first
      • Mustaches will be used as a standard library for processing templates
      • If there is a need, another implementation will be connected (freemarker, velocity, etc.) later
      • The Template entity should include a resolver property which will indicate which resolver should be used when compiling that template.
      Method Description
      POST /template/result POST context for forming result text/html/doc/etc from template

      Request:
      {
      "templateId":"xxxxxxxx - xxxx - Mxxx - Nxxx - xxxxxxxxxxxx",
      "lang":"en",
      "outputFormat":"plainText",
      "context":{
      "User":

      { "name":"Alex" }

      ,
      "Item":

      { "name":"My Item" }

      }
      }

      Response:

      {
      "templateId":"xxxxxxxx - xxxx - Mxxx - Nxxx - xxxxxxxxxxxx",
      "payload":{
      "result":"Hello Alex your item is My Item",
      "meta":

      { "size":"16", "dateCreate":"24.11.2018", "lang":"en", "outputFormat":"plainText" }

      }
      }

      Acceptance Criteria

      Given template "Hello ${context.User.name} your item is ${context.Item.name}" stored at db
      When I create POST request to /template/result (view request)
      Then I get response with formatted message (view response)

      unit tests are created and passed

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                kgambrell Khalilah Gambrell
                OleksiiKuzminov Oleksii Kuzminov
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases