Skip to content

Extraneous comma in generated code #7

@ghivert

Description

@ghivert

Hi!

I was playing with JSON Typedef. Unfortunately, generated code is invalid :(

{
  "properties": {
    "element_type": { "enum": ["paragraph", "table", "heading"] }
  },
  "optionalProperties": {
    "kind": { "enum": ["paragraph", "table"] }
  }
}

The previous schema generated code is invalid 😭

fn helper__optional_property(
  object: List(#(String, json.Json)),
  key: String,
  value: option.Option(a),
  to_json: fn(a) -> json.Json,
) -> List(#(String, json.Json)), {
  case value {
    option.Some(value) -> [#(key, to_json(value)), ..object]
    option.None -> object
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions