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

feat: Formating Module #71

Merged
merged 24 commits into from
Jun 7, 2022
Merged

feat: Formating Module #71

merged 24 commits into from
Jun 7, 2022

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 💻 Concerns the backend code in the repository state/confirmed 💜 type/feature ⭐ Addition of new feature priority/high 🟧 Priority 2 - Stalls work on the project or its dependents 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/backend 💻 Concerns the backend code in the repository aspect/dex 🤖 Concerns developers' experience with the codebase priority/high 🟧 Priority 2 - Stalls work on the project or its dependents type/feature ⭐ Addition of new feature
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants