Skip to content

feat: Formating Module#71

Merged
42atomys merged 24 commits intomainfrom
feat/formating
Jun 7, 2022
Merged

feat: Formating Module#71
42atomys merged 24 commits intomainfrom
feat/formating

Conversation

@42atomys
Copy link
Owner

@42atomys 42atomys commented Jun 4, 2022

Describe the pull request
Add possibility to format the received data as the user want in each storage or in all storage

Checklist

  • I have linked the relative issue to this pull request
  • I have made the modifications or added tests related to my PR
  • I have added/updated the documentation for my RP
  • I put my PR in Ready for Review only when all the checklist is checked

Breaking changes ?
no

Additional context
By default the formating is {{ .Payload }} but can be customized with golang template.

One example
template file or string

{
  "config": "{{ toJson .Config }}",
  "storage": {{ toJson .Storage }},
  "metadata": {
    "model": "{{ .Request.Header | getHeader "X-Model" }}",
    "event": "{{ .Request.Header | getHeader "X-Event" }}",
    "deliveryID": "{{ .Request.Header | getHeader "X-Delivery" | default "unknown" }}"
  },
  "payload": {{ .Payload }}
}

data sended to the storage

{
  "config": {
    "apiVersion":"v1alpha1",
    "observability":{
      "metricsEnabled":true
    },
    "specs":[
      {
        "name":"exampleHook",
        "entrypointUrl":"/webhooks/duoapi"
      }
    ]
  },
  "storage": {
    "type":"rabbitmq"
  },
  "metadata": {
    "model": "user",
    "event": "create",
    "deliveryID": "68c302c8-54c7-4fff-91ef-d3dd85d84ceb"
  },
  "payload": {
    "id": 8509185,
    "login": "atomys",
    "github": "https://github.com/42Atomys"
  }
}

@42atomys 42atomys self-assigned this Jun 4, 2022
@42atomys 42atomys added aspect/dex 🤖 Concerns developers' experience with the codebase aspect/backend 💻 type/feature ⭐ Addition of new feature priority/p2-block ⚠️ ⚠️ High – blocking work or dependencies (P2) labels Jun 4, 2022
@42atomys 42atomys added this to the 1.0 milestone Jun 4, 2022
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Jun 5, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2022

Codecov Report

❗ No coverage uploaded for pull request base (main@d93e491). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #71   +/-   ##
=======================================
  Coverage        ?   90.36%           
=======================================
  Files           ?       22           
  Lines           ?      944           
  Branches        ?        0           
=======================================
  Hits            ?      853           
  Misses          ?       70           
  Partials        ?       21           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d93e491...37948cd. Read the comment docs.

@42atomys 42atomys marked this pull request as ready for review June 7, 2022 13:18
@42atomys 42atomys requested a review from rgaiffe as a code owner June 7, 2022 13:18
@42atomys 42atomys merged commit a06b045 into main Jun 7, 2022
@42atomys 42atomys deleted the feat/formating branch June 7, 2022 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aspect/dex 🤖 Concerns developers' experience with the codebase priority/p2-block ⚠️ ⚠️ High – blocking work or dependencies (P2) type/feature ⭐ Addition of new feature

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants