spago icon indicating copy to clipboard operation
spago copied to clipboard

Mixed case configuration for publish location

Open natefaubion opened this issue 1 year ago • 7 comments

It looks like the configuration consistently uses snake case everywhere, but there's still some camel case for "location". Screen Shot 2023-12-13 at 11 24 42 AM

natefaubion avatar Dec 13 '23 19:12 natefaubion

I agree that we should choose one case or another and standardize on it. I believe the choice so far has been snake case.

I suspect the reason location uses camel case is because Spago's yaml parsing first converts to JSON and then reuses the Registry json codecs to parse the result, and same for printing. JSON always uses camel case, so any registry type found in the spago.yaml file is going to end up using camel case.

It seems there are a few ways forward:

  1. Accept mixed case in the spago.yaml (I think this is a bad idea because you can't easily reason about what format a given field will take)
  2. Standardize on snake case (We would need to convert camel case to snake case and vice versa when using registry types)
  3. Standardize on camel case (Registry types would then work as-is).

I think most yaml I've seen in the wild uses camel case and/or dash case, hence why we've done that in Spago. But it seems that there really isn't a canonical YAML format: https://stackoverflow.com/questions/22771226/what-is-the-canonical-yaml-naming-style

I am personally fine with using camel case throughout the spago.yaml files; it's certainly the easiest option especially since we always operate on the yaml via JSO, we are reusing JSON codecs from the registry, and PureScript itself as a language is camel case. But it's really @f-f's call.

thomashoneyman avatar Dec 13 '23 19:12 thomashoneyman

I'd prefer camelCase. All those _ are annoying to type.

JordanMartinez avatar Dec 13 '23 21:12 JordanMartinez

I have no preference as long as it's consistent. The only constraint I have is that we should do all the renaming before we get out of alpha so we can just change them around and we don't have to support multiple formats (in this codebase at least, I believe the Registry will support both since some packages got published with a spago.yaml only?)

f-f avatar Dec 14 '23 07:12 f-f

Yes, the registry will have to support both, but only for the 'publish' section of the configuration since that's all it parses.

thomashoneyman avatar Dec 14 '23 13:12 thomashoneyman

I'd prefer snake case, but i don't mind too much either.

So what will be the final decision?

nate: snake thomas: snake jordan: camel f-f: undecided

Is it like this so far?

flip111 avatar Dec 24 '23 22:12 flip111

As Thomas noted, there's no real convention for YAML and it's about the surrounding conventions - PureScript uses CamelCase so that's likely to be the most natural choice.

I'd say we should try out how CamelCase reads and go from there.

f-f avatar Dec 24 '23 22:12 f-f

I don’t think Nate expressed a preference. I think camel is the most reasonable choice given the JSON round tripping and PureScript as the surrounding context.

thomashoneyman avatar Dec 24 '23 23:12 thomashoneyman