Skip to content

Asset paths may not reach outside the packageΒ #198

@Involute1

Description

@Involute1

Is your issue related to the code that was generated?

No, my issue is with the openapi-generator-dart wrapper/config

Description of the bug

When trying to execute the build_runner step it works on Windows but not on Linux/MacOs. It is with a spec that lives outside the flutter project.

Error message:
Invalid argument (Asset paths may not reach outside the package.): "../../spec/openapi/fairticken.yml"

Steps to reproduce

Execute the following on Mac/Linux:

flutter clean
flutter pub get
dart run build_runner build -d

Minimal openapi specification

openapi: 3.1.0
info:
  title: 😒 Funny-Sad API
  version: "1.0.0"
  description: |
    An API for when everything is technically working, but emotionally not.

paths:
  /coffee:
    post:
      summary: Attempt to fix feelings with coffee
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                shots:
                  type: integer
                  minimum: 1
                  default: 1
                  description: More shots β‰  more happiness, but we try.
      responses:
        "202":
          description: Brewing hope. Please hold.
        "507":
          description: Insufficient Storage (of beans and optimism).

Annotation used

@Openapi(
    inputSpec: RemoteSpec(path: "../../spec/openapi/myyaml.yml"),
    generatorName: Generator.dio,
    outputDirectory: 'api/',
    additionalProperties: DioProperties(pubName: 'myName', pubAuthor: 'myAuthor'),
    runSourceGenOnOutput: true,
    debugLogging: false)

Expected behavior

On Windows, it gets generated no problem. So I expect the same on Linux/MacOs

Logs

Flutter 3.35.5 β€’ channel stable β€’ https://github.com/flutter/flutter.git
Framework β€’ revision ac4e799d23 (5 weeks ago) β€’ 2025-09-26 12:05:09 -0700
Engine β€’ hash 0274ead41f6265309f36e9d74bc8c559becd5345 (revision d3d45dcf25) (1 months ago) β€’ 2025-09-26 16:45:18.000Z
Tools β€’ Dart 3.9.2 β€’ DevTools 2.48.0

Screenshots

No response

Platform

Linux / MacOS

Library version

5747abf

Flutter version

3.35.5

Flutter channel

stable

Additional context

build.yaml

targets:
  $default:
    sources:
      - $package$
      - lib/**
      - ../../spec/openapi/myyaml.yml
Dependency version:

  openapi_generator:
    git:
      url: https://github.com/gibahjoe/openapi-generator-dart.git
      path: openapi-generator
      ref: 5747abf64ce56896f4837984f240e50140aad6d2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions