Skip to content

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

Open
@zkessin

Description

@zkessin

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
          }
        }
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions