tailcallhq / tailcall

High Performance GraphQL Runtime
https://tailcall.run
Apache License 2.0
1.26k stars 237 forks source link

Types with Single Fields Not Flattened in GraphQL Config Generation #2558

Closed amitksingh1490 closed 3 weeks ago

amitksingh1490 commented 1 month ago

Description With the provided configuration, some types with single fields are not getting flattened as expected. The relevant configuration is given below:

headers: &headers
  appversion: "11.3.1-WEB"
  authorization: "Bearer <Put your token here>"
  platform: "WEB"
inputs:
  - curl:
      src: "https://cx.zepto.co.in/api/v1/pass/overview"
      fieldName: "overview"
      headers: *headers
  - curl:
      src: "https://api.zepto.co.in/api/v3/inventory/catalogue/store-products/?store_id=bc6a4a81-1c35-457e-a732-7ca7198ee2ef&subcategory_id=84f270cf-ae95-4d61-a556-b35b563fb947&page_number=2&user_session_id=4d8c9ce6-d3b2-45e3-a22c-d9bf0c99b589"
      fieldName: "storeProducts"
      headers: *headers
  - curl:
      src: https://api.zepto.co.in/api/v2/order/?page_number=1
      fieldName: "myOrders"
      headers: *headers
  - curl:
      src: "https://api.zepto.co.in/api/v1/order/be2574f3-8d25-4d95-9ac8-adf4b745381f/"
      fieldName: "orderDetails"
      headers: *headers
  - curl:
      src: "https://api.zepto.co.in/api/v1/user/customer/addresses/"
      fieldName: "addresses"
      headers: *headers
  - curl:
      src: "https://www.zeptonow.com/api/wallet/transactions"
      fieldName: "transactions"
      headers:
        authorization: "<Put your token here>"
  - curl:
      src: "https://api-gateway.zepto.co.in/recipe-service/api/v1/recipes?pageNumber=0&pageSize=10"
      fieldName: "recipes"
      headers: *headers
  - curl:
      src: "https://api.zepto.co.in/api/v2/inventory/catalogue/recommended-products?store_id=bc6a4a81-1c35-457e-a732-7ca7198ee2ef&preview_mode=true&is_trending_feed_enabled=true&is_zepto_three_enabled=true&is_trending_feed_experiment_enabled=true"
      fieldName: "recommendedProducts"
      headers: *headers
preset:
  mergeType: 0.75
  consolidateURL: 0.5
  useBetterNames: true
  treeShake: true
output:
  path: "./generated.graphql"
  format: "graphQL"
schema:
  query: "Query"
image
amitksingh1490 commented 1 month ago

/bounty 50$

algora-pbc[bot] commented 1 month ago

💎 $50 bounty • Tailcall Inc.

Steps to solve:

  1. Start working: Comment /attempt #2558 with your implementation plan
  2. Submit work: Create a pull request including /claim #2558 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

🙏 Thank you for contributing to tailcallhq/tailcall! 🧐 Checkout our guidelines before you get started. 💵 More about our bounty program.

Attempt Started (GMT+0) Solution
🔴 @Shylock-Hg Jul 29, 2024, 2:10:48 AM WIP
🟢 @dekkku #2723
tusharmath commented 1 month ago

This feature was developed here — https://github.com/tailcallhq/tailcall/pull/2356

Shylock-Hg commented 1 month ago

/attempt #2558

Algora profile Completed bounties Tech Active attempts Options
@Shylock-Hg    9 tailcallhq bounties
+ 3 bounties from 3 projects
C++, C,
Shell & more
Cancel attempt
Shylock-Hg commented 1 month ago

@amitksingh1490 I think you should add

unwrapSingleFieldTypes: true

to preset.

ssddOnTop commented 1 month ago

@amitksingh1490 I think you should add

unwrapSingleFieldTypes: true

to preset.

Already done in https://github.com/tailcallhq/tailcall/issues/2555

algora-pbc[bot] commented 1 month ago

@Shylock-Hg: Reminder that in 1 days the bounty will become up for grabs, so please submit a pull request before then 🙏

algora-pbc[bot] commented 1 month ago

The bounty is up for grabs! Everyone is welcome to /attempt #2558 🙌

algora-pbc[bot] commented 3 weeks ago

💡 @dekkku submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] commented 3 weeks ago

🎉🎈 @dekkku has been awarded $50! 🎈🎊