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

Refactor Compiler Plugin Code and Invalidate Path Parameters #510

Merged
merged 3 commits into from
Dec 8, 2021

Conversation

ThisaruGuruge
Copy link
Member

Purpose

  • Refactoring the compiler plugin code to match with the compile-time schema generation task.
  • Disallow the path parameters and resource functions without resource path (dotted resources).

Fixes: #2465

Examples

The following resource functions inside a GraphQL service will cause compilation errors.

Example 1 - Path Parameters:

resource function get profile/[string id]/name() returns string {
    return "Walter White";
}

Example 2 - Path rest parameters:

resource function get profile/[string ...ids] returns string {
    return "Walter White";
}

Example 3 - Dotted resource paths:

resource function get .() returns int {
    return 767;
}

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests

@codecov
Copy link

codecov bot commented Dec 7, 2021

Codecov Report

Merging #510 (e23025e) into master (9b21ede) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #510   +/-   ##
=========================================
  Coverage     94.59%   94.59%           
  Complexity      335      335           
=========================================
  Files            53       53           
  Lines          3368     3368           
  Branches       1748     1748           
=========================================
  Hits           3186     3186           
  Misses          153      153           
  Partials         29       29           
Impacted Files Coverage Δ
ballerina/response_formatter.bal 97.93% <0.00%> (-1.03%) ⬇️
ballerina/engine.bal 98.43% <0.00%> (+1.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b21ede...e23025e. Read the comment docs.

@ThisaruGuruge ThisaruGuruge merged commit d6efd0b into master Dec 8, 2021
@ThisaruGuruge ThisaruGuruge deleted the compiler-plugin-refactor branch December 8, 2021 05:02
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.

GraphQL Resources Allow Path Parameters
2 participants