Saturn.Cli icon indicating copy to clipboard operation
Saturn.Cli copied to clipboard

Field `id` assumed to exist

Open dharmatech opened this issue 5 years ago • 0 comments

I ran the following :

dotnet saturn gen Movie Movies Id:int Title:string ReleaseDate:DateTime Genre:string Price:decimal Rating:string

When building, there were many errors like the following:

error FS0039: The type 'Movie' does not define the field, constructor or member 'id'.

The generated code which led to the errors:

image

It looks like Saturn.Cli assumes the existence of a field id. Note that in the above case, the field is Id.

Seems like there are a few ways to resolve this. Saturn.Cli could do one of the following (among other possible suggestions):

  • Refuse to generate code if id is not provided (simplest)
  • Honor a field named Id instead of id
  • Allow the user to specify an id field that is named arbitrarily

dharmatech avatar Feb 09 '21 00:02 dharmatech