-
Notifications
You must be signed in to change notification settings - Fork 25
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
Unable to limit types that are generated #167
Comments
Sorry, forgot to mention, I am using version 1.50 of your plugin. Thanks.
|
Hi @davidvc - I will take a look tonight and follow up. |
Great thanks!
…On Tue, Jul 30, 2024 at 12:52 PM deweyjose ***@***.***> wrote:
Hi @davidvc <https://github.com/davidvc> - I will take a look tonight and
follow up.
—
Reply to this email directly, view it on GitHub
<#167 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAARO73IJQZWK5BX3QFPBUDZO7VJVAVCNFSM6AAAAABLSKAHVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJZGA4TQMJRGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I've created a PR example repo run some experiments. With the following configuration <configuration>
<packageName>com.acme</packageName>
<generateClientApiV2>true</generateClientApiV2>
<includeMutations>
<param>addPage</param>
</includeMutations>
<includeQueries></includeQueries>
<includeSubscriptions></includeSubscriptions>
<skipEntityQueries>true</skipEntityQueries>
<maxProjectionDepth>2</maxProjectionDepth>
<generateDataTypes>false</generateDataTypes>
<schemaPaths>
<param>src/main/resources/schema/schema.graphqls</param>
</schemaPaths>
</configuration> I see the following output (similar to yours):
And I see the following generated client code: By |
I think what's probably happening is the By adding the following to my configuration:
The generated code is much smaller for me now. I also updated the mutation to accept an input type to verify types only has the type required by the single mutation. schema: type Query {
books: [Book]
publishers: [Publisher]
authors: [Author]
}
type Mutation {
addPage(bookId: ID!, number: Int!, content: String!): Page
addPublisher(name: String!): Publisher
addAuthor(name: String!): Author
addBook(book: BookInput!): Book
}
input BookInput {
title: String!
}
type Book {
id: ID!
title: String!
pages: [Page]
}
type Page {
id: ID!
number: Int!
content: String!
}
type Publisher {
id: ID!
name: String!
books: [Book]
}
type Author {
id: ID!
name: String!
books: [Book]
} |
@davidvc Could you try adding The client code generation that uses the config object constructed by input params (both this maven plugin and the DGS gradle plugin) needs something in the array to filter against. If the array is empty there is no filter. |
This is great, thanks! I'll give that a try when I get back in the office
on Monday.
David
…On Sat, Aug 3, 2024, 8:30 AM deweyjose ***@***.***> wrote:
@davidvc <https://github.com/davidvc> For now I'd try adding
<param>-</param> to each of the include lists you want to disable for
now. I'll take a look at making this more convenient (or updating the docs)
in a new point release.
—
Reply to this email directly, view it on GitHub
<#167 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAARO7Y2MCVUBLCDZSKJLODZPTZQZAVCNFSM6AAAAABLSKAHVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRWHAYTEOJYGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi @davidvc just following up to see if you're all set. Would like to close this issue if so. |
Hey I'm sorry. I got pulled into other things. Let me make sure this works
I'll get back to you soon.
…On Fri, Aug 16, 2024, 7:46 AM deweyjose ***@***.***> wrote:
Hi @davidvc <https://github.com/davidvc> just following up to see if
you're all set. Would like to close this issue if so.
—
Reply to this email directly, view it on GitHub
<#167 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAARO74PHWXEOISNYOULYMDZRYGDZAVCNFSM6AAAAABLSKAHVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTGY2DMNZTGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yep, that worked! I also got a much smaller set! Thanks so much! |
Do you want to keep this open, since this is just a workaround? Or is the bug in the core codegen repo? |
I'm inclined to just close and highlight the subtleties in the README. IMO |
OK sounds good. Thanks again! A big win for us, we have a massive schema
…On Mon, Aug 19, 2024 at 7:36 AM deweyjose ***@***.***> wrote:
I'm inclined to just close and highlight the subtleties in the README.
IMO <param>""</param> is aligned with how the gradle plugin managed by
Netflix behaves and is documented
<https://netflix.github.io/dgs/generating-code-from-schema/#generating-query-apis-for-external-services>
.
image.png (view on web)
<https://github.com/user-attachments/assets/0aa1a724-84f6-4c05-bd2c-0dde317ae1d5>
—
Reply to this email directly, view it on GitHub
<#167 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAARO73I4H754P4LK5L3K7TZSH7HLAVCNFSM6AAAAABLSKAHVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJWG4ZTMOJWGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm not sure what happened. Perhaps I didn't test with full schema like I thought I did. With this configuration I got the following output, and 2,880 types were generated from a 78,000 line supergraph :(
Here's the debug output
|
I just saw generate-data-type was true. I changed it to false, same result, all types generated. I'm sure I'm missing something obvious :(
|
No worries, @davidvc - any chance you can test with a newer version of the plugin? I'll try again tonight to make sure I wasn't missing something in my config as well. |
Hello. I am trying to follow the instructions documented here to limit the types generated. We have a very large federated supergraph (sorry I am not able to share it publicly), and I just want the code necessary for a specific mutation.
Here is what the pom configuration looks like for the plugin:
I run
mvn clean generate-sources
and it generates code for every single type, input type, query, mutation and enum in the entire schema.Here is the output provided by your plugin for the call made to the core codegen library:
This all looks correct according to the documentation. So I'm not sure what I'm doing wrong here. It makes the codegen essentialy unusable because such a massive amount of code is being generated. There should be about 25 types generated, instead I get around 500.
Thanks!
The text was updated successfully, but these errors were encountered: