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

[QUESTION] Path still gets generated even when told not to #245

Closed
dtaskai opened this issue Sep 20, 2021 · 7 comments · Fixed by #246 or #250
Closed

[QUESTION] Path still gets generated even when told not to #245

dtaskai opened this issue Sep 20, 2021 · 7 comments · Fixed by #246 or #250
Assignees
Labels
question Further information is requested

Comments

@dtaskai
Copy link

dtaskai commented Sep 20, 2021

Path still gets generated in the swagger.dart file when specified like the following in the build.yaml file:

targets:
$default:
sources:
- lib/**
- $package$
builders:
chopper_generator:
options:
header: "//Generated code"
swagger_dart_code_generator:
options:
input_folder: "lib/"
output_folder: "lib/swagger_generated_code/"
exclude_paths:
- "/api/mobile/actuator/"

Am I using wrong syntax or is this an actual bug?

@dtaskai dtaskai added the question Further information is requested label Sep 20, 2021
@Vovanella95
Copy link
Collaborator

hi @dtaskai , exclude_path and include_path are regex strings. to make your path excluded, you need to add something like this:

\/api\/mobile\/actuator\/

Please use Regex validator to check is you String passing or not. For example, you can use this validator: https://regex101.com/

@Vovanella95
Copy link
Collaborator

@dtaskai , if something is not clear - please let us know

@dtaskai
Copy link
Author

dtaskai commented Sep 22, 2021

The exclusion didn't work on my project even after using regex syntax, so I have tried it on the example project:

Added an exclusion to /rooms

targets:
  $default:
    sources:
      - lib/**
      - swaggers/**
      - swaggers2/**
      - swagger_examples/**
      - $package$
    builders:
      chopper_generator:
        options:
          header: "//Generated code"
      swagger_dart_code_generator:
        options:
          input_folder: "lib/"
          output_folder: "lib/swagger_generated_code/"
          exclude_paths:
            - "\/rooms"

Ran flutter build run build_runner build

Then it still generated the code for /rooms

@Get(path: '/rooms')
  Future<chopper.Response<List<Room>>> roomsGet(
      {@Query('id') required String? id});

@Vovanella95
Copy link
Collaborator

Ok good let me check it

@Vovanella95 Vovanella95 reopened this Sep 22, 2021
@Vovanella95
Copy link
Collaborator

@dtaskai Yep you're right. We removed it in 2+ version. Let me fix.

@Vovanella95
Copy link
Collaborator

@dtaskai Please try it on latest version. Also you can put just /rooms to exclude_path. It works.

Latest version is 2.1.3+2

@dtaskai
Copy link
Author

dtaskai commented Sep 22, 2021

Works on both the example and my personal project, thank you!

@dtaskai dtaskai closed this as completed Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
3 participants