Skip to content

feat(graphql): Add extensions and errors keys in response. - #2035

Merged
lbroudoux merged 2 commits into
microcks:masterfrom
pablomxnl:feature/add-errors-and-extensions-graphql
May 4, 2026
Merged

lbroudoux merged 2 commits into
microcks:masterfrom
pablomxnl:feature/add-errors-and-extensions-graphql

Conversation

@pablomxnl

Copy link
Copy Markdown
Contributor

Description

  • Adds support for errors and extensions top level key in graphql json response
  • Adds integration test.

Related issue(s)

Resolves #2034

Test results

query / mutation with errors and extensions in response

curl -X POST 'http://localhost:8080/graphql/Movie+Graph+API/1.0' -H 'Content-Type: application/json' -d '{"query":"mutation AddStar($filmId: String) {\n  addStar(filmId: $filmId) {\n    id\n    title\n    episodeID\n    director\n    starCount\n    rating\n  }\n}","variables":{"filmId":"notavailable"}}' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   444  100   246  100   198  17545  14121 --:--:-- --:--:-- --:--:-- 34153
{
  "data": {
    "addStar": null
  },
  "errors": [
    {
      "message": "The system is not available, due to maintenance, please try again later.",
      "extensions": {
        "code": "MAINTENANCE_MODE"
      }
    }
  ],
  "extensions": {
    "correlationId": {
      "traceId": "0c025278-f518-47a0-b8b8-9088e277d968"
    }
  }
}

example query without errors/extensions

curl -X POST 'http://localhost:8080/graphql/Movie+Graph+API/1.0' -H 'Content-Type: application/json' -d '{"query":"query {\n  allFilms {\n    films {\n      id\n      title\n      episodeID\n      director\n      starCount\n      rating\n    }\n  }\n}"}' | jq 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   907  100   759  100   148  39857   7771 --:--:-- --:--:-- --:--:-- 50388
{
  "data": {
    "allFilms": {
      "films": [
        {
          "id": "ZmlsbXM6MQ==",
          "title": "A New Hope",
          "episodeID": 4,
          "director": "George Lucas",
          "starCount": 432,
          "rating": 4.3
        },
        {
          "id": "ZmlsbXM6Mg==",
          "title": "The Empire Strikes Back",
          "episodeID": 5,
          "director": "Irvin Kershner",
          "starCount": 433,
          "rating": 4.3
        },
        {
          "id": "ZmlsbXM6Mw==",
          "title": "Return of the Jedi",
          "episodeID": 6,
          "director": "Richard Marquand",
          "starCount": 434,
          "rating": 4.3
        },
        {
          "id": "ZmlsbXM6NA==",
          "title": "The Phantom Menace",
          "episodeID": 1,
          "director": "George Lucas",
          "starCount": 252,
          "rating": 3.2
        },
        {
          "id": "ZmlsbXM6NQ==",
          "title": "Attack of the Clones",
          "episodeID": 2,
          "director": "George Lucas",
          "starCount": 320,
          "rating": 3.9
        },
        {
          "id": "ZmlsbXM6Ng==",
          "title": "Revenge of the Sith",
          "episodeID": 3,
          "director": "George Lucas",
          "starCount": 410,
          "rating": 4.1
        }
      ]
    }
  }
}

Screenshot_20260411_115554

@github-actions

Copy link
Copy Markdown

👋 @pablomxnl

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

@pablomxnl
pablomxnl force-pushed the feature/add-errors-and-extensions-graphql branch from 936665d to 0f67870 Compare April 11, 2026 10:07
@lbroudoux

Copy link
Copy Markdown
Member

Hey @pablomxnl!
Thanks for pushing this one. Will review it asap but please consider my comment on the issue: after reviewing, we'll wait a bit to initialize 1.15 on master to embed this change in the next big stream. Trying to ship the 1.14 ATM 😉

@lbroudoux lbroudoux added this to the 1.15.0 milestone Apr 20, 2026

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks all good apart from the imports style. Can you please restore the existing imports and keep the conventions?

Restore style of imports.
Signed-off-by: Pablo Gutiérrez <[email protected]>

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lbroudoux
lbroudoux merged commit d244e68 into microcks:master May 4, 2026
11 of 12 checks passed
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

🎉 @pablomxnl

You are now a Microcks community contributor! 💖

Thanks and congrats 🚀 on merging your first pull request! We are delighted and very proud of you! 👏

📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌"

Kudos and please keep going, we need you 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graphql : Add support for errors and extensions top level keys in graphql responses.

2 participants