Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ jobs:
with:
go-version-file: go.mod
cache: false
- uses: dart-lang/setup-dart@v1
with:
sdk: 3.13.4
- name: Restore Go modules, compiler, and linter caches
id: go-cache
uses: actions/cache@v6
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,3 @@ dump-*.json
/testdata/rust-client/src/public/
/testdata/rust-client/src/models/
/testdata/rust-client/src/responses/
/testdata/dart-client/.dart_tool/
/testdata/dart-client/lib/public/
/testdata/dart-client/lib/models/
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ optional `responseError` callback translates non-success statuses to the
application's error types. Operation methods encode paths and query parameters,
decode typed JSON models, and return SSE responses as streams for the caller to
frame. JSON response reads have a 4 MiB bound.
The Dart SDK is required when emitting Dart output so OASmith can format the
generated files.
Dart generation writes files directly without a Dart or Flutter SDK.

Generated clients require an explicit client base URL and use it for every
operation. OpenAPI server declarations do not change the runtime destination.
Expand Down
12 changes: 0 additions & 12 deletions internal/dartemit/dartemit.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
package dartemit

import (
"context"
"fmt"
"os"
"os/exec"
"path/filepath"
"slices"
"sort"
"strconv"
"strings"
"time"
"unicode"

"github.com/responsibleapi/oasmith/internal/clientgen"
Expand Down Expand Up @@ -105,7 +102,6 @@ func (e *emitter) writeFiles(outDir, models string, operations []clientgen.Opera
if err := os.WriteFile(modelsPath, []byte(models), 0o600); err != nil {
return fmt.Errorf("write dart models: %w", err)
}
paths := []string{modelsPath}
if client {
api := e.apiSource(operations)
if e.err != nil {
Expand All @@ -115,14 +111,6 @@ func (e *emitter) writeFiles(outDir, models string, operations []clientgen.Opera
if err := os.WriteFile(apiPath, []byte(api), 0o600); err != nil {
return fmt.Errorf("write dart client: %w", err)
}
paths = append(paths, apiPath)
}
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
// #nosec G204 -- The executable is fixed and paths are passed as arguments without a shell.
command := exec.CommandContext(ctx, "dart", append([]string{"format", "--output=write"}, paths...)...)
if output, err := command.CombinedOutput(); err != nil {
return fmt.Errorf("format dart output: %w: %s", err, strings.TrimSpace(string(output)))
}
return nil
}
Expand Down
32 changes: 0 additions & 32 deletions moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ tasks:
- ~:lint
- ~:test
- ~:test-rust
- ~:test-dart
inputs: []
options:
runInCI: false
Expand Down Expand Up @@ -85,34 +84,3 @@ tasks:
command: cargo test --locked --manifest-path testdata/rust-client/Cargo.toml
options:
cache: true
generate-dart-fixtures:
deps: [~:mod-download]
inputs:
- "@group(sources)"
- testdata/fixtures/*.yaml
script: |-
set -euo pipefail
go run ./cmd/oasmith --openapi testdata/fixtures/public-client.yaml --mode client --lang dart --out testdata/dart-client/lib/public
go run ./cmd/oasmith --openapi testdata/fixtures/rust-models.yaml --mode types --lang dart --out testdata/dart-client/lib/models
outputs:
- testdata/dart-client/lib/public/api.dart
- testdata/dart-client/lib/public/models.dart
- testdata/dart-client/lib/models/models.dart
options:
cache: true
test-dart:
deps: [~:generate-dart-fixtures]
inputs:
- "@group(sources)"
- testdata/fixtures/*.yaml
- testdata/dart-client/pubspec.yaml
- testdata/dart-client/lib/**/*.dart
- testdata/dart-client/bin/**/*.dart
script: |-
set -euo pipefail
cd testdata/dart-client
dart pub get
dart analyze
dart run bin/check.dart
options:
cache: true
9 changes: 0 additions & 9 deletions oasmith_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"strings"
"testing"

"github.com/responsibleapi/oasmith/internal/dartemit"
"github.com/responsibleapi/oasmith/internal/goemit"
"github.com/responsibleapi/oasmith/internal/openapi"
"github.com/responsibleapi/oasmith/internal/tsemit"
Expand Down Expand Up @@ -70,14 +69,6 @@ func TestGoldenFixtures(t *testing.T) {
return tsemit.Emit(doc, tsemit.Options{OutDir: outDir})
},
},
{
name: "public-client-dart",
fixture: "public-client.yaml",
golden: "public-client-dart",
emit: func(doc *openapi.Document, outDir string, _ string) error {
return dartemit.Emit(doc, dartemit.Options{OutDir: outDir}, true)
},
},
} {
t.Run(testCase.name, func(t *testing.T) {
t.Parallel()
Expand Down
58 changes: 0 additions & 58 deletions testdata/dart-client/bin/check.dart

This file was deleted.

93 changes: 0 additions & 93 deletions testdata/dart-client/pubspec.lock

This file was deleted.

6 changes: 0 additions & 6 deletions testdata/dart-client/pubspec.yaml

This file was deleted.

Loading