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 use forceGenerate and extraFields together #2788

Merged

Conversation

atzedus
Copy link
Contributor

@atzedus atzedus commented Sep 8, 2023

gqlgen.yaml:

autobind:
  - mypkg
models:
  Person:
    forceGenerate: true
    extraFields:
      IsAdmin:
        type: bool

schema:

type Person {
  id: ID!
  name: String!
}

Сurrent behavior:

type Person struct {
	ID                              string      `json:"id"`
	Name                            string      `json:"name"`
}

Expected behavior (this PR fix it):

type Person struct {
	ID                              string      `json:"id"`
	Name                            string      `json:"name"`
	IsAdmin                            bool      `json:"isAdmin"`
}

I have:

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

@coveralls
Copy link

coveralls commented Sep 9, 2023

Coverage Status

coverage: 75.703% (-0.04%) from 75.74% when pulling c8847f0 on atzedus:force-generate-and-extra-fields into f90ac05 on 99designs:master.

@StevenACoffman StevenACoffman merged commit 9930e57 into 99designs:master Sep 9, 2023
17 checks passed
@StevenACoffman
Copy link
Collaborator

Thanks for this and your other contributions! Nice work!

@atzedus atzedus deleted the force-generate-and-extra-fields branch September 9, 2023 00:10
github-merge-queue bot referenced this pull request in infratographer/x Sep 28, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/99designs/gqlgen](https://togithub.com/99designs/gqlgen) |
require | patch | `v0.17.36` -> `v0.17.38` |

---

### Release Notes

<details>
<summary>99designs/gqlgen (github.com/99designs/gqlgen)</summary>

###
[`v0.17.38`](https://togithub.com/99designs/gqlgen/releases/tag/v0.17.38)

[Compare
Source](https://togithub.com/99designs/gqlgen/compare/v0.17.37...v0.17.38)

#### What's Changed

- Ability to use forceGenerate and extraFields together by
[@&#8203;atzedus](https://togithub.com/atzedus) in
[https://github.com/99designs/gqlgen/pull/2788](https://togithub.com/99designs/gqlgen/pull/2788)
- Add new changelog by
[@&#8203;StevenACoffman](https://togithub.com/StevenACoffman) in
[https://github.com/99designs/gqlgen/pull/2787](https://togithub.com/99designs/gqlgen/pull/2787)
- Fix rand int docs link in Getting Started by
[@&#8203;stevenschobert](https://togithub.com/stevenschobert) in
[https://github.com/99designs/gqlgen/pull/2789](https://togithub.com/99designs/gqlgen/pull/2789)
- Make it possible to pass UI headers to GraphiQL by
[@&#8203;marcusthelin](https://togithub.com/marcusthelin) in
[https://github.com/99designs/gqlgen/pull/2793](https://togithub.com/99designs/gqlgen/pull/2793)
- Return `null` instead of zero value uuid by
[@&#8203;0x221A](https://togithub.com/0x221A) in
[https://github.com/99designs/gqlgen/pull/2794](https://togithub.com/99designs/gqlgen/pull/2794)
- Update gqlparser to 2.5.10 by
[@&#8203;StevenACoffman](https://togithub.com/StevenACoffman) in
[https://github.com/99designs/gqlgen/pull/2798](https://togithub.com/99designs/gqlgen/pull/2798)

#### New Contributors

- [@&#8203;stevenschobert](https://togithub.com/stevenschobert) made
their first contribution in
[https://github.com/99designs/gqlgen/pull/2789](https://togithub.com/99designs/gqlgen/pull/2789)
- [@&#8203;marcusthelin](https://togithub.com/marcusthelin) made their
first contribution in
[https://github.com/99designs/gqlgen/pull/2793](https://togithub.com/99designs/gqlgen/pull/2793)
- [@&#8203;0x221A](https://togithub.com/0x221A) made their first
contribution in
[https://github.com/99designs/gqlgen/pull/2794](https://togithub.com/99designs/gqlgen/pull/2794)

**Full Changelog**:
99designs/gqlgen@v0.17.37...v0.17.38

###
[`v0.17.37`](https://togithub.com/99designs/gqlgen/blob/HEAD/CHANGELOG.md#v01737---2023-09-08)

[Compare
Source](https://togithub.com/99designs/gqlgen/compare/v0.17.36...v0.17.37)

- <a
href="https://togithub.com/99designs/gqlgen/commit/ccae370e96cbca6ce5deaabf28a6d57e3b181b3b"><tt>[`ccae370`](https://togithub.com/99designs/gqlgen/commit/ccae370e)</tt></a>
release v0.17.37

- <a
href="https://togithub.com/99designs/gqlgen/commit/6505f8be0d99593376d6c9a0dea00af5e3c018ea"><tt>[`6505f8b`](https://togithub.com/99designs/gqlgen/commit/6505f8be)</tt></a>
Update gqlparser (<a
href="https://togithub.com/99designs/gqlgen/pull/2785">[#&#8203;2785](https://togithub.com/99designs/gqlgen/issues/2785)</a>)

<dl><dd><details><summary><a
href="https://togithub.com/99designs/gqlgen/commit/153ec470d993a39c1656fc45432740f1d3dd10ea"><tt>153ec470</tt></a>
add uuid type (<a
href="https://togithub.com/99designs/gqlgen/pull/2751">#&#8203;2751</a>)
(closes <a href="https://togithub.com/99designs/gqlgen/issues/2749">
#&#8203;2749</a>)</summary>

-   add uuid type

-   add uuid example

-   add uuid scalar doc

-   strconv.Quote

-   Apply suggestions from code review

-   fix

***

</details></dd></dl>

<dl><dd><details><summary><a
href="https://togithub.com/99designs/gqlgen/commit/fa4711801c59d27db887a50e1f8393006268194e"><tt>fa471180</tt></a>
ForceGenerate parameter to
[@&#8203;goModel](https://togithub.com/goModel) added. (<a
href="https://togithub.com/99designs/gqlgen/pull/2780">#&#8203;2780</a>)</summary>

-   forceGenerate to docs added

***

</details></dd></dl>

<dl><dd><details><summary><a
href="https://togithub.com/99designs/gqlgen/commit/11bb9b1890fd9e5909f06feba7b2985bf09785c9"><tt>11bb9b18</tt></a>
codegen: add support for `go_build_tags` option in gqlgen.yaml (<a
href="https://togithub.com/99designs/gqlgen/pull/2784">#&#8203;2784</a>)</summary>

-   codegen: support go_build_tags option in gqlgen.yaml

-   chore: added test

-   docs/content: update config example

-   chore: more comment

</details></dd></dl>

<dl><dd><details><summary><a
href="https://togithub.com/99designs/gqlgen/commit/bee47dcf1f3edb95e7a77e612ea27d85a417b12c"><tt>bee47dcf</tt></a>
fix flaky test TestSubscriptions (<a
href="https://togithub.com/99designs/gqlgen/pull/2779">#&#8203;2779</a>)</summary>

-   fix flaky test TestSubscriptions

-   update other copy of the test

</details></dd></dl>

- <a
href="https://togithub.com/99designs/gqlgen/commit/a41f4daad66cb0c102bfa09d7bff5a057d378197"><tt>[`a41f4da`](https://togithub.com/99designs/gqlgen/commit/a41f4daa)</tt></a>
docs: short-lived loader (<a
href="https://togithub.com/99designs/gqlgen/pull/2778">[#&#8203;2778](https://togithub.com/99designs/gqlgen/issues/2778)</a>)

- <a
href="https://togithub.com/99designs/gqlgen/commit/cc4e0ba28375e0ec39c586485fa138c28e5bfcba"><tt>[`cc4e0ba`](https://togithub.com/99designs/gqlgen/commit/cc4e0ba2)</tt></a>
ensure HasOperationContext checks for nil (<a
href="https://togithub.com/99designs/gqlgen/pull/2776">[#&#8203;2776](https://togithub.com/99designs/gqlgen/issues/2776)</a>)

<dl><dd><details><summary><a
href="https://togithub.com/99designs/gqlgen/commit/a1ca220477092398efc8e587dd653f5cb967d0e9"><tt>a1ca2204</tt></a>
fix typo in TESTING.md server path (<a
href="https://togithub.com/99designs/gqlgen/pull/2774">#&#8203;2774</a>)</summary>

following TESTING.md instructions, I got an error:
"stat ./server/server.go: no such file or directory"

server.go path is: integration/server/cmd/integration/server.go

</details></dd></dl>

<dl><dd><details><summary><a
href="https://togithub.com/99designs/gqlgen/commit/1cde8c3fab65847a6e8d7f423215b786b47c19df"><tt>1cde8c3f</tt></a>
return internal types in schema introspection (<a
href="https://togithub.com/99designs/gqlgen/pull/2773">#&#8203;2773</a>)</summary>

according to graphql spec:

types: return the set of all named types contained within this schema.
Any named type which can be found through a field of any introspection
type must be included in this set.

source:
https://github.com/graphql/graphql-spec/blob/main/spec/Section%204%20--%20Introspection.md#the-\__schema-type

some clients libs (like HotChocolate for C#) depends on this behavior.

</details></dd></dl>

- <a
href="https://togithub.com/99designs/gqlgen/commit/065aea3efa27f0662eb2f62ef2dd131e153009ba"><tt>[`065aea3`](https://togithub.com/99designs/gqlgen/commit/065aea3e)</tt></a>
Fix gqlgen truncates tag value with colon (<a
href="https://togithub.com/99designs/gqlgen/pull/2759">[#&#8203;2759](https://togithub.com/99designs/gqlgen/issues/2759)</a>)

- <a
href="https://togithub.com/99designs/gqlgen/commit/d6270e4f4fd951c71ee2a2b997d7098b04e07976"><tt>[`d6270e4`](https://togithub.com/99designs/gqlgen/commit/d6270e4f)</tt></a>
Update subsciptions documentation to correctly close channel (<a
href="https://togithub.com/99designs/gqlgen/pull/2753">[#&#8203;2753](https://togithub.com/99designs/gqlgen/issues/2753)</a>)

- <a
href="https://togithub.com/99designs/gqlgen/commit/2d8673a691deffe6ddd1f4d5f013a52dc91aef91"><tt>[`2d8673a`](https://togithub.com/99designs/gqlgen/commit/2d8673a6)</tt></a>
Add Model references to Interface (<a
href="https://togithub.com/99designs/gqlgen/pull/2738">[#&#8203;2738](https://togithub.com/99designs/gqlgen/issues/2738)</a>)

- <a
href="https://togithub.com/99designs/gqlgen/commit/790d7a7571865b8b8324557e1a565f40c23217c8"><tt>[`790d7a7`](https://togithub.com/99designs/gqlgen/commit/790d7a75)</tt></a>
Allow GraphiQL headers to be set when creating the playground handler
(<a
href="https://togithub.com/99designs/gqlgen/pull/2740">[#&#8203;2740](https://togithub.com/99designs/gqlgen/issues/2740)</a>)
(closes <a href="https://togithub.com/99designs/gqlgen/issues/2739">
[#&#8203;2739](https://togithub.com/99designs/gqlgen/issues/2739)</a>)

- <a
href="https://togithub.com/99designs/gqlgen/commit/0eb95dc4315fc5f74431df03e008283cf9ec0c35"><tt>[`0eb95dc`](https://togithub.com/99designs/gqlgen/commit/0eb95dc4)</tt></a>
v0.17.36 postrelease bump

 <!-- end of Commits -->

<!-- end of Else -->

<!-- end of If NoteGroups -->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/infratographer/x).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuOTcuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

3 participants