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

Fix passing input parameters in a form of JSON string via GraphQL Gateway #77

Merged
merged 3 commits into from
Dec 9, 2020

Conversation

pkosiec
Copy link
Member

@pkosiec pkosiec commented Dec 8, 2020

Description

Changes proposed in this pull request:

  • Investigate and fix issue related to passing input with JSON string
  • Use forks for Nautilus GraphQL and GraphQL Go

The problem was down in the dependency tree:

nautilus/gateway -> nautilus/graphql -> graphql-go/graphql

See the fix in the underlying library graphql-go:
Issue: graphql-go/graphql#586
Pull request: graphql-go/graphql#587

I also updated my original issue on Nautilus Gateway: nautilus/gateway#121

How to test it

Run the local cluster on this branch:

make dev-cluster

Navigate to https://gateway.voltron.local and run the following GraphQL query:

mutation CreateAction {
  createAction(
    in: {
      name: "sample"
      actionRef: {
        path: "cap.interface.productivity.jira.install"
      },
      input: {
        parameters: "{\"input1\": \"foo\", \"input2\": 2, \"input3\": { \"nested\": true }}",
        typeInstances: [
          { name: "foo", id: "fee33a5e-d957-488a-86bd-5dacd4120312" }
          { name: "bar", id: "563a79eb-7417-4e11-aa4b-d93076c04e48" }
        ]
      }
      dryRun: true
    }
  ) {
    name
    createdAt
    actionRef {
      path
      revision
    }
    renderedAction
    cancel
    run
    dryRun
    input {
      parameters
      typeInstances {
        name
        typeRef {
          path
          revision
        }
        id
        optional
      }
    }
    output {
      typeInstances {
        name
        typeRef {
          path
          revision
        }
        id
      }
    }
    renderingAdvancedMode {
      enabled
      typeInstancesForRenderingIteration {
        name
        typeRef {
          path
          revision
        }
        id
        optional
      }
    }
    renderedActionOverride
    status {
      condition
      timestamp
      message
      runner {
        status
      }
      cancelledBy {
        username
        groups
        extra
      }
      runBy {
        username
        groups
        extra
      }
      createdBy {
        username
        groups
        extra
      }
    }
  }
}

Aaand... it works now! 🎉
Just to confirm the parameters have been properly saved - see the secret:

kubectl get secret sample --template={{.data.parameters}} | base64 -D

@pkosiec pkosiec added bug Something isn't working WIP Work in progress labels Dec 8, 2020
@pkosiec pkosiec removed the WIP Work in progress label Dec 8, 2020
@pkosiec pkosiec marked this pull request as ready for review December 8, 2020 18:04
@mszostok mszostok self-assigned this Dec 8, 2020
go.mod Show resolved Hide resolved
@pkosiec pkosiec merged commit 488f8c0 into master Dec 9, 2020
@pkosiec pkosiec deleted the fix-gateway-gql-input branch December 9, 2020 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants