iluvadev / PocketBaseClient

C# client to interact with a particular PocketBase application: an ORM mapped to your PocketBase server. [This project is in active development. The things described below could change]
MIT License
34 stars 8 forks source link

Prefix for invalid Enum identifiers (e.g. numbers) #41

Open ibanks42 opened 5 months ago

ibanks42 commented 5 months ago

Just added a quick regex check before generating Select/Enum values for identifying invalid starting characters based on the language specification.

For example a Select with the values 1, 2

would output:

public enum ExampleEnum
{
    [Description("1")]
    1,

    [Description("2")]
    2,
}

This change would prefix them with 'E' like pocketbase-typegen does.

public enum ShiftEnum
{
    [Description("1")]
    E1,

    [Description("2")]
    E2,
}
ibanks42 commented 5 months ago

Fix of #40

First pull request I've ever really done. Realized after doing it the first time I borked it by pulling in the SDK which had some changes that shouldn't have been part of the PR. Not sure how to fix it so unfortunately had to make a new one.