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

feat(gen): support proto_paths for gen graphql through proto file #3206

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

DLillard0
Copy link
Contributor

@DLillard0 DLillard0 commented Dec 7, 2024

Summary:

Currently, when using the tailcall gen command to process proto files, the import path is fixed to a relative path, but in the protobuf import syntax, you can specify the path to find the dependency using the -I/--proto_path flag. So, most proto projects are currently organized in this way, and I think we also need to support it.

{
  "inputs": [
    {
      "proto": {
        "src": "./proto/apps/mian.proto",
        "url": "http://localhost:8080",
        // new params
        "protoPaths": ["./proto/apps"]
      }
    }
  ],
  "preset": {
    "mergeType": 1.0
  },
  "output": {
    "path": "./output/main.graphql",
    "format": "graphQL"
  },
  "schema": {
    "query": "Query"
  }
}

Issue Reference(s):

None

Build & Testing:

  • I ran cargo test successfully.
  • I have run ./lint.sh --mode=fix to fix all linting issues raised by ./lint.sh --mode=check.

Checklist:

  • I have added relevant unit & integration tests.
  • I have updated the documentation accordingly.
  • I have performed a self-review of my code.
  • PR follows the naming convention of <type>(<optional scope>): <title>

@github-actions github-actions bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Dec 7, 2024
@tusharmath
Copy link
Contributor

Can't we use src to specify the protoPath instead of creating a new field?

@DLillard0
Copy link
Contributor Author

DLillard0 commented Dec 7, 2024

proto_path specifies the search path for dependent files in src file.
I think they should have different meanings.

file path: proto/apps/notification_center/api/v1/audience.proto

syntax = "proto3";
package notification_center.api.v1;

import "notification_center/types/v1/model.proto";

dependence import "notification_center/types/v1/model.proto" now it will be parsed as proto/apps/notification_center/api/v1/notification_center/types/v1/model.proto

using "protoPaths": ["./proto/apps"] it will be parsed as proto/apps/notification_center/types/v1/model.proto

Copy link

codecov bot commented Dec 7, 2024

Codecov Report

Attention: Patch coverage is 96.77419% with 2 lines in your changes missing coverage. Please review.

Project coverage is 86.75%. Comparing base (fe220be) to head (6340d95).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/core/proto_reader/reader.rs 95.45% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3206      +/-   ##
==========================================
+ Coverage   86.73%   86.75%   +0.01%     
==========================================
  Files         278      278              
  Lines       27918    27963      +45     
==========================================
+ Hits        24214    24258      +44     
- Misses       3704     3705       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tusharmath tusharmath force-pushed the feature/support-proto-paths branch from 424b746 to 6bcd740 Compare December 8, 2024 16:59
@DLillard0 DLillard0 force-pushed the feature/support-proto-paths branch from 6bcd740 to bf6e377 Compare December 9, 2024 03:00
@tusharmath tusharmath force-pushed the feature/support-proto-paths branch from bf6e377 to 9bcf429 Compare December 9, 2024 05:43
@tusharmath tusharmath added the ci: lint Automatically fix the linters issues and make a commit label Dec 9, 2024
@tusharmath tusharmath force-pushed the feature/support-proto-paths branch from 9bcf429 to 61cd2a4 Compare December 9, 2024 06:05
@tusharmath tusharmath enabled auto-merge (squash) December 9, 2024 06:05
@tusharmath tusharmath force-pushed the feature/support-proto-paths branch from e8783d3 to 6340d95 Compare December 9, 2024 06:47
@tusharmath tusharmath merged commit 858ac97 into tailcallhq:main Dec 9, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci: lint Automatically fix the linters issues and make a commit type: feature Brand new functionality, features, pages, workflows, endpoints, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants