Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to inline extraFields configuration. New @goExtraField directive. #3076

Merged

Conversation

atzedus
Copy link
Contributor

@atzedus atzedus commented May 15, 2024

@goExtraField directive added for inline configuration.

Example of use:

type User
	@goExtraField(
		name: "Session"
		type: "github.com/author/mypkg.Session"
		description: "A Session used by this user"
		overrideTags: "xml:\"session\""
	)
	@goExtraField(name: "Activated", type: "bool") {
	id: ID
	name: String
}

The generated code would look like:

type User struct {
  ID   string
  Name string
  // A Session used by this user.
  Session   mypkg.Session `xml:"session"`
  Activated bool
}

This is more usefull raise then configuration in yaml, like:

models:
  User:
    extraFields:
      Session:
        description: "A Session used by this user"
        type: "github.com/author/mypkg.Session"
        overrideTags: 'xml:"session"'
      Activated:
        type: "bool"

because all the fields of the model are in front of your eyes.

I have:

  • Added tests covering the bug / feature (see testing)
  • Updated any relevant documentation (see docs)

@StevenACoffman StevenACoffman merged commit de31828 into 99designs:master May 15, 2024
15 of 16 checks passed
@StevenACoffman
Copy link
Collaborator

Thanks! Nice improvement!

@atzedus atzedus deleted the ability-to-inline-extra-fields-config branch May 15, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants