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

Absinthe.Formatter.format/2 formats input: into one very long line #1307

Open
zkessin opened this issue Mar 8, 2024 · 1 comment
Open

Absinthe.Formatter.format/2 formats input: into one very long line #1307

zkessin opened this issue Mar 8, 2024 · 1 comment

Comments

@zkessin
Copy link

zkessin commented Mar 8, 2024

I am trying to format a mutation query with a long input with the graphql formatter and it is doing something strange. All of the input data has been put onto one very long line. (See bellow)

mutation {
  createInverter(
    input: {
      adapterConfiguration: {
        name: "sims"
        simulation: { enabled: false, startingStorage: "100" }
      }
      baselineConfiguration: {
        method: POWER_PRIOR_TO_VPP_EVENT
        telemetrySource: INVERTER
      }
      connectedBatteries: [
        {
          controlConstraints: {}
          nominalEnergy: "0"
          operationalConstraints: { ratedEnergy: "5000", ratedPower: "50000" }
          remoteId: "inverter 2 battery"
        }
      ]
      connectedPhotovoltaics: [
        {
          operationalConstraints: { ratedPower: "50000" }
          remoteId: "inverter 2 pv"
        }
      ]
      name: "Inverter2"
      operationalConstraints: { efficiency: "97", ratedPower: "199000" }
      remoteId: "Inverter 2 remote id"
    }
  ) {
    inverter {
      remoteId
    }
  }
}

But it formats like this

      mutation {
        createInverter(
          input: { adapterConfiguration: { name: "sims", simulation: { enabled: false, startingStorage: "100" } }, baselineConfiguration: { method: POWER_PRIOR_TO_VPP_EVENT, telemetrySource: INVERTER }, connectedBatteries: [{ controlConstraints: {  }, nominalEnergy: "0", operationalConstraints: { ratedEnergy: "5000", ratedPower: "50000" }, remoteId: "inverter 2 battery" }], connectedPhotovoltaics: [{ operationalConstraints: { ratedPower: "50000" }, remoteId: "inverter 2 pv" }], name: "Inverter2", operationalConstraints: { efficiency: "97", ratedPower: "199000" }, remoteId: "Inverter 2 remote id" }
        ) {
          inverter {
            remoteId
          }
        }
      }

@benwilson512
Copy link
Contributor

benwilson512 commented Mar 12, 2024

Ah yeah that does seem nonoptimal. PR welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants