Browse Source

dynamite: Init

pull/61/head
jld3103 2 years ago
parent
commit
873a581df8
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 352
      .github/workflows/dart.yml
  2. 10
      packages/dynamite/.gitignore
  3. 9
      packages/dynamite/analysis_options.yaml
  4. 22
      packages/dynamite/build.yaml
  5. 4
      packages/dynamite/lib/builder.dart
  6. 15
      packages/dynamite/lib/dynamite.dart
  7. 20
      packages/dynamite/lib/src/models/components.dart
  8. 36
      packages/dynamite/lib/src/models/components.g.dart
  9. 25
      packages/dynamite/lib/src/models/info.dart
  10. 37
      packages/dynamite/lib/src/models/info.g.dart
  11. 21
      packages/dynamite/lib/src/models/license.dart
  12. 35
      packages/dynamite/lib/src/models/license.g.dart
  13. 16
      packages/dynamite/lib/src/models/media_type.dart
  14. 30
      packages/dynamite/lib/src/models/media_type.g.dart
  15. 41
      packages/dynamite/lib/src/models/open_api.dart
  16. 49
      packages/dynamite/lib/src/models/open_api.g.dart
  17. 31
      packages/dynamite/lib/src/models/operation.dart
  18. 41
      packages/dynamite/lib/src/models/operation.g.dart
  19. 29
      packages/dynamite/lib/src/models/parameter.dart
  20. 39
      packages/dynamite/lib/src/models/parameter.g.dart
  21. 68
      packages/dynamite/lib/src/models/path_item.dart
  22. 60
      packages/dynamite/lib/src/models/path_item.g.dart
  23. 3
      packages/dynamite/lib/src/models/paths.dart
  24. 22
      packages/dynamite/lib/src/models/request_body.dart
  25. 36
      packages/dynamite/lib/src/models/request_body.g.dart
  26. 19
      packages/dynamite/lib/src/models/response.dart
  27. 35
      packages/dynamite/lib/src/models/response.g.dart
  28. 3
      packages/dynamite/lib/src/models/responses.dart
  29. 53
      packages/dynamite/lib/src/models/schema.dart
  30. 67
      packages/dynamite/lib/src/models/schema.g.dart
  31. 1
      packages/dynamite/lib/src/models/security_requirement.dart
  32. 19
      packages/dynamite/lib/src/models/security_scheme.dart
  33. 35
      packages/dynamite/lib/src/models/security_scheme.g.dart
  34. 19
      packages/dynamite/lib/src/models/server.dart
  35. 35
      packages/dynamite/lib/src/models/server.g.dart
  36. 23
      packages/dynamite/lib/src/models/server_variable.dart
  37. 35
      packages/dynamite/lib/src/models/server_variable.g.dart
  38. 15
      packages/dynamite/lib/src/models/tag.dart
  39. 21
      packages/dynamite/lib/src/models/tag.g.dart
  40. 1244
      packages/dynamite/lib/src/openapi_builder.dart
  41. 7
      packages/dynamite/mono_pkg.yaml
  42. 20
      packages/dynamite/pubspec.yaml
  43. 1
      tool/.gitattributes
  44. 8
      tool/ci.sh

352
.github/workflows/dart.yml

@ -37,6 +37,198 @@ jobs:
- name: mono_repo self validate - name: mono_repo self validate
run: dart pub global run mono_repo generate --validate run: dart pub global run mono_repo generate --validate
job_002: job_002:
name: "analyze; PKG: packages/dynamite; `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/dynamite;commands:analyze_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/dynamite
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- id: packages_dynamite_pub_upgrade
name: packages/dynamite; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: packages/dynamite
- name: "packages/dynamite; dart analyze --fatal-infos ."
run: dart analyze --fatal-infos .
if: "always() && steps.packages_dynamite_pub_upgrade.conclusion == 'success'"
working-directory: packages/dynamite
needs:
- job_001
job_003:
name: "analyze; PKG: packages/nextcloud; `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/nextcloud;commands:analyze_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/nextcloud
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- id: packages_nextcloud_pub_upgrade
name: packages/nextcloud; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: packages/nextcloud
- name: "packages/nextcloud; dart analyze --fatal-infos ."
run: dart analyze --fatal-infos .
if: "always() && steps.packages_nextcloud_pub_upgrade.conclusion == 'success'"
working-directory: packages/nextcloud
needs:
- job_001
job_004:
name: "analyze; PKG: packages/nextcloud_push_proxy; `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/nextcloud_push_proxy;commands:analyze_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/nextcloud_push_proxy
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- id: packages_nextcloud_push_proxy_pub_upgrade
name: packages/nextcloud_push_proxy; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: packages/nextcloud_push_proxy
- name: "packages/nextcloud_push_proxy; dart analyze --fatal-infos ."
run: dart analyze --fatal-infos .
if: "always() && steps.packages_nextcloud_push_proxy_pub_upgrade.conclusion == 'success'"
working-directory: packages/nextcloud_push_proxy
needs:
- job_001
job_005:
name: "analyze; PKG: packages/sort_box; `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/sort_box;commands:analyze_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/sort_box
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- id: packages_sort_box_pub_upgrade
name: packages/sort_box; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: packages/sort_box
- name: "packages/sort_box; dart analyze --fatal-infos ."
run: dart analyze --fatal-infos .
if: "always() && steps.packages_sort_box_pub_upgrade.conclusion == 'success'"
working-directory: packages/sort_box
needs:
- job_001
job_006:
name: "analyze; PKG: packages/spec_templates; `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/spec_templates;commands:analyze_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/spec_templates
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- id: packages_spec_templates_pub_upgrade
name: packages/spec_templates; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: packages/spec_templates
- name: "packages/spec_templates; dart analyze --fatal-infos ."
run: dart analyze --fatal-infos .
if: "always() && steps.packages_spec_templates_pub_upgrade.conclusion == 'success'"
working-directory: packages/spec_templates
needs:
- job_001
job_007:
name: "analyze; PKG: packages/dynamite; `dart format --output=none --set-exit-if-changed --line-length 120 .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/dynamite;commands:format"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/dynamite
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- id: packages_dynamite_pub_upgrade
name: packages/dynamite; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: packages/dynamite
- name: "packages/dynamite; dart format --output=none --set-exit-if-changed --line-length 120 ."
run: "dart format --output=none --set-exit-if-changed --line-length 120 ."
if: "always() && steps.packages_dynamite_pub_upgrade.conclusion == 'success'"
working-directory: packages/dynamite
needs:
- job_001
job_008:
name: "analyze; PKG: packages/file_icons; `dart format --output=none --set-exit-if-changed --line-length 120 .`" name: "analyze; PKG: packages/file_icons; `dart format --output=none --set-exit-if-changed --line-length 120 .`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -68,7 +260,7 @@ jobs:
working-directory: packages/file_icons working-directory: packages/file_icons
needs: needs:
- job_001 - job_001
job_003: job_009:
name: "analyze; PKG: packages/neon; `dart format --output=none --set-exit-if-changed --line-length 120 .`" name: "analyze; PKG: packages/neon; `dart format --output=none --set-exit-if-changed --line-length 120 .`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -100,7 +292,7 @@ jobs:
working-directory: packages/neon working-directory: packages/neon
needs: needs:
- job_001 - job_001
job_004: job_010:
name: "analyze; PKG: packages/nextcloud; `dart format --output=none --set-exit-if-changed --line-length 120 .`" name: "analyze; PKG: packages/nextcloud; `dart format --output=none --set-exit-if-changed --line-length 120 .`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -132,7 +324,7 @@ jobs:
working-directory: packages/nextcloud working-directory: packages/nextcloud
needs: needs:
- job_001 - job_001
job_005: job_011:
name: "analyze; PKG: packages/nextcloud_push_proxy; `dart format --output=none --set-exit-if-changed --line-length 120 .`" name: "analyze; PKG: packages/nextcloud_push_proxy; `dart format --output=none --set-exit-if-changed --line-length 120 .`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -164,7 +356,7 @@ jobs:
working-directory: packages/nextcloud_push_proxy working-directory: packages/nextcloud_push_proxy
needs: needs:
- job_001 - job_001
job_006: job_012:
name: "analyze; PKG: packages/settings; `dart format --output=none --set-exit-if-changed --line-length 120 .`" name: "analyze; PKG: packages/settings; `dart format --output=none --set-exit-if-changed --line-length 120 .`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -196,7 +388,7 @@ jobs:
working-directory: packages/settings working-directory: packages/settings
needs: needs:
- job_001 - job_001
job_007: job_013:
name: "analyze; PKG: packages/sort_box; `dart format --output=none --set-exit-if-changed --line-length 120 .`" name: "analyze; PKG: packages/sort_box; `dart format --output=none --set-exit-if-changed --line-length 120 .`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -228,7 +420,7 @@ jobs:
working-directory: packages/sort_box working-directory: packages/sort_box
needs: needs:
- job_001 - job_001
job_008: job_014:
name: "analyze; PKG: packages/spec_templates; `dart format --output=none --set-exit-if-changed --line-length 120 .`" name: "analyze; PKG: packages/spec_templates; `dart format --output=none --set-exit-if-changed --line-length 120 .`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -260,7 +452,7 @@ jobs:
working-directory: packages/spec_templates working-directory: packages/spec_templates
needs: needs:
- job_001 - job_001
job_009: job_015:
name: "analyze; PKG: packages/file_icons; `flutter analyze --fatal-infos .`" name: "analyze; PKG: packages/file_icons; `flutter analyze --fatal-infos .`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -268,7 +460,7 @@ jobs:
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with: with:
path: "~/.pub-cache/hosted" path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/file_icons;commands:analyze_0" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/file_icons;commands:analyze_1"
restore-keys: | restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/file_icons os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/file_icons
os:ubuntu-latest;pub-cache-hosted;sdk:stable os:ubuntu-latest;pub-cache-hosted;sdk:stable
@ -292,7 +484,7 @@ jobs:
working-directory: packages/file_icons working-directory: packages/file_icons
needs: needs:
- job_001 - job_001
job_010: job_016:
name: "analyze; PKG: packages/neon; `flutter analyze --fatal-infos .`" name: "analyze; PKG: packages/neon; `flutter analyze --fatal-infos .`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -300,7 +492,7 @@ jobs:
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with: with:
path: "~/.pub-cache/hosted" path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/neon;commands:analyze_0" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/neon;commands:analyze_1"
restore-keys: | restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/neon os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/neon
os:ubuntu-latest;pub-cache-hosted;sdk:stable os:ubuntu-latest;pub-cache-hosted;sdk:stable
@ -324,7 +516,7 @@ jobs:
working-directory: packages/neon working-directory: packages/neon
needs: needs:
- job_001 - job_001
job_011: job_017:
name: "analyze; PKG: packages/settings; `flutter analyze --fatal-infos .`" name: "analyze; PKG: packages/settings; `flutter analyze --fatal-infos .`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -332,7 +524,7 @@ jobs:
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with: with:
path: "~/.pub-cache/hosted" path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/settings;commands:analyze_0" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/settings;commands:analyze_1"
restore-keys: | restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/settings os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/settings
os:ubuntu-latest;pub-cache-hosted;sdk:stable os:ubuntu-latest;pub-cache-hosted;sdk:stable
@ -356,135 +548,7 @@ jobs:
working-directory: packages/settings working-directory: packages/settings
needs: needs:
- job_001 - job_001
job_012: job_018:
name: "analyze; PKG: packages/nextcloud; `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/nextcloud;commands:analyze_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/nextcloud
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- id: packages_nextcloud_pub_upgrade
name: packages/nextcloud; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: packages/nextcloud
- name: "packages/nextcloud; dart analyze --fatal-infos ."
run: dart analyze --fatal-infos .
if: "always() && steps.packages_nextcloud_pub_upgrade.conclusion == 'success'"
working-directory: packages/nextcloud
needs:
- job_001
job_013:
name: "analyze; PKG: packages/nextcloud_push_proxy; `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/nextcloud_push_proxy;commands:analyze_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/nextcloud_push_proxy
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- id: packages_nextcloud_push_proxy_pub_upgrade
name: packages/nextcloud_push_proxy; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: packages/nextcloud_push_proxy
- name: "packages/nextcloud_push_proxy; dart analyze --fatal-infos ."
run: dart analyze --fatal-infos .
if: "always() && steps.packages_nextcloud_push_proxy_pub_upgrade.conclusion == 'success'"
working-directory: packages/nextcloud_push_proxy
needs:
- job_001
job_014:
name: "analyze; PKG: packages/sort_box; `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/sort_box;commands:analyze_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/sort_box
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- id: packages_sort_box_pub_upgrade
name: packages/sort_box; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: packages/sort_box
- name: "packages/sort_box; dart analyze --fatal-infos ."
run: dart analyze --fatal-infos .
if: "always() && steps.packages_sort_box_pub_upgrade.conclusion == 'success'"
working-directory: packages/sort_box
needs:
- job_001
job_015:
name: "analyze; PKG: packages/spec_templates; `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/spec_templates;commands:analyze_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:packages/spec_templates
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- id: packages_spec_templates_pub_upgrade
name: packages/spec_templates; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: packages/spec_templates
- name: "packages/spec_templates; dart analyze --fatal-infos ."
run: dart analyze --fatal-infos .
if: "always() && steps.packages_spec_templates_pub_upgrade.conclusion == 'success'"
working-directory: packages/spec_templates
needs:
- job_001
job_016:
name: "unit_test; PKG: packages/nextcloud; `dart test`" name: "unit_test; PKG: packages/nextcloud; `dart test`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -530,7 +594,9 @@ jobs:
- job_013 - job_013
- job_014 - job_014
- job_015 - job_015
job_017: - job_016
- job_017
job_019:
name: "unit_test; PKG: packages/sort_box; `dart test`" name: "unit_test; PKG: packages/sort_box; `dart test`"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -576,3 +642,5 @@ jobs:
- job_013 - job_013
- job_014 - job_014
- job_015 - job_015
- job_016
- job_017

10
packages/dynamite/.gitignore vendored

@ -0,0 +1,10 @@
# Files and directories created by pub.
.dart_tool/
.packages
# Conventional directory for build outputs.
build/
# Omit committing pubspec.lock for library packages; see
# https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock

9
packages/dynamite/analysis_options.yaml

@ -0,0 +1,9 @@
include: package:nit_picking/dart.yaml
linter:
rules:
public_member_api_docs: false
analyzer:
exclude:
- '**.g.dart'

22
packages/dynamite/build.yaml

@ -0,0 +1,22 @@
targets:
$default:
builders:
json_serializable:
options:
disallow_unrecognized_keys: true
explicit_to_json: true
create_factory: true
create_to_json: true
include_if_null: false
dynamite:
enabled: true
builders:
dynamite:
import: "package:dynamite/builder.dart"
builder_factories: ["openAPIBuilder"]
build_extensions: {'.openapi.json': ['openapi.dart']}
auto_apply: root_package
build_to: source
runs_before: ["json_serializable"]
applies_builders: ["json_serializable"]

4
packages/dynamite/lib/builder.dart

@ -0,0 +1,4 @@
import 'package:build/build.dart';
import 'package:dynamite/dynamite.dart';
Builder openAPIBuilder(final BuilderOptions options) => OpenAPIBuilder();

15
packages/dynamite/lib/dynamite.dart

@ -0,0 +1,15 @@
library dynamite;
import 'dart:convert';
import 'package:build/build.dart';
import 'package:code_builder/code_builder.dart';
import 'package:dart_style/dart_style.dart';
import 'package:dynamite/src/models/open_api.dart';
import 'package:dynamite/src/models/parameter.dart' as spec_parameter;
import 'package:dynamite/src/models/path_item.dart';
import 'package:dynamite/src/models/schema.dart';
import 'package:dynamite/src/models/tag.dart';
import 'package:path/path.dart' as p;
part 'src/openapi_builder.dart';

20
packages/dynamite/lib/src/models/components.dart

@ -0,0 +1,20 @@
import 'package:dynamite/src/models/schema.dart';
import 'package:dynamite/src/models/security_scheme.dart';
import 'package:json_annotation/json_annotation.dart';
part 'components.g.dart';
@JsonSerializable()
class Components {
Components({
required this.securitySchemes,
required this.schemas,
});
factory Components.fromJson(final Map<String, dynamic> json) => _$ComponentsFromJson(json);
Map<String, dynamic> toJson() => _$ComponentsToJson(this);
final Map<String, SecurityScheme>? securitySchemes;
final Map<String, Schema>? schemas;
}

36
packages/dynamite/lib/src/models/components.g.dart

@ -0,0 +1,36 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'components.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Components _$ComponentsFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['securitySchemes', 'schemas'],
);
return Components(
securitySchemes: (json['securitySchemes'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, SecurityScheme.fromJson(e as Map<String, dynamic>)),
),
schemas: (json['schemas'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, Schema.fromJson(e as Map<String, dynamic>)),
),
);
}
Map<String, dynamic> _$ComponentsToJson(Components instance) {
final val = <String, dynamic>{};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('securitySchemes', instance.securitySchemes?.map((k, e) => MapEntry(k, e.toJson())));
writeNotNull('schemas', instance.schemas?.map((k, e) => MapEntry(k, e.toJson())));
return val;
}

25
packages/dynamite/lib/src/models/info.dart

@ -0,0 +1,25 @@
import 'package:dynamite/src/models/license.dart';
import 'package:json_annotation/json_annotation.dart';
part 'info.g.dart';
@JsonSerializable()
class Info {
Info({
required this.title,
required this.version,
required this.description,
required this.license,
});
factory Info.fromJson(final Map<String, dynamic> json) => _$InfoFromJson(json);
Map<String, dynamic> toJson() => _$InfoToJson(this);
final String title;
final String version;
final String? description;
final License license;
}

37
packages/dynamite/lib/src/models/info.g.dart

@ -0,0 +1,37 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'info.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Info _$InfoFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['title', 'version', 'description', 'license'],
);
return Info(
title: json['title'] as String,
version: json['version'] as String,
description: json['description'] as String?,
license: License.fromJson(json['license'] as Map<String, dynamic>),
);
}
Map<String, dynamic> _$InfoToJson(Info instance) {
final val = <String, dynamic>{
'title': instance.title,
'version': instance.version,
};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('description', instance.description);
val['license'] = instance.license.toJson();
return val;
}

21
packages/dynamite/lib/src/models/license.dart

@ -0,0 +1,21 @@
import 'package:json_annotation/json_annotation.dart';
part 'license.g.dart';
@JsonSerializable()
class License {
License({
required this.name,
required this.identifier,
required this.url,
});
factory License.fromJson(final Map<String, dynamic> json) => _$LicenseFromJson(json);
Map<String, dynamic> toJson() => _$LicenseToJson(this);
final String name;
final String? identifier;
final String? url;
}

35
packages/dynamite/lib/src/models/license.g.dart

@ -0,0 +1,35 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'license.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
License _$LicenseFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['name', 'identifier', 'url'],
);
return License(
name: json['name'] as String,
identifier: json['identifier'] as String?,
url: json['url'] as String?,
);
}
Map<String, dynamic> _$LicenseToJson(License instance) {
final val = <String, dynamic>{
'name': instance.name,
};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('identifier', instance.identifier);
writeNotNull('url', instance.url);
return val;
}

16
packages/dynamite/lib/src/models/media_type.dart

@ -0,0 +1,16 @@
import 'package:dynamite/src/models/schema.dart';
import 'package:json_annotation/json_annotation.dart';
part 'media_type.g.dart';
@JsonSerializable()
class MediaType {
MediaType({
required this.schema,
});
factory MediaType.fromJson(final Map<String, dynamic> json) => _$MediaTypeFromJson(json);
Map<String, dynamic> toJson() => _$MediaTypeToJson(this);
final Schema? schema;
}

30
packages/dynamite/lib/src/models/media_type.g.dart

@ -0,0 +1,30 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'media_type.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
MediaType _$MediaTypeFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['schema'],
);
return MediaType(
schema: json['schema'] == null ? null : Schema.fromJson(json['schema'] as Map<String, dynamic>),
);
}
Map<String, dynamic> _$MediaTypeToJson(MediaType instance) {
final val = <String, dynamic>{};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('schema', instance.schema?.toJson());
return val;
}

41
packages/dynamite/lib/src/models/open_api.dart

@ -0,0 +1,41 @@
import 'package:dynamite/src/models/components.dart';
import 'package:dynamite/src/models/info.dart';
import 'package:dynamite/src/models/path_item.dart';
import 'package:dynamite/src/models/paths.dart';
import 'package:dynamite/src/models/security_requirement.dart';
import 'package:dynamite/src/models/server.dart';
import 'package:dynamite/src/models/tag.dart';
import 'package:json_annotation/json_annotation.dart';
part 'open_api.g.dart';
@JsonSerializable()
class OpenAPI {
OpenAPI({
required this.version,
required this.info,
required this.servers,
required this.security,
required this.tags,
required this.components,
required this.paths,
});
factory OpenAPI.fromJson(final Map<String, dynamic> json) => _$OpenAPIFromJson(json);
Map<String, dynamic> toJson() => _$OpenAPIToJson(this);
@JsonKey(name: 'openapi')
final String version;
final Info info;
final List<Server>? servers;
final List<SecurityRequirement>? security;
final List<Tag>? tags;
final Components? components;
final Paths? paths;
}

49
packages/dynamite/lib/src/models/open_api.g.dart

@ -0,0 +1,49 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'open_api.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
OpenAPI _$OpenAPIFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['openapi', 'info', 'servers', 'security', 'tags', 'components', 'paths'],
);
return OpenAPI(
version: json['openapi'] as String,
info: Info.fromJson(json['info'] as Map<String, dynamic>),
servers: (json['servers'] as List<dynamic>?)?.map((e) => Server.fromJson(e as Map<String, dynamic>)).toList(),
security: (json['security'] as List<dynamic>?)
?.map((e) => (e as Map<String, dynamic>).map(
(k, e) => MapEntry(k, (e as List<dynamic>).map((e) => e as String).toList()),
))
.toList(),
tags: (json['tags'] as List<dynamic>?)?.map((e) => Tag.fromJson(e as Map<String, dynamic>)).toList(),
components: json['components'] == null ? null : Components.fromJson(json['components'] as Map<String, dynamic>),
paths: (json['paths'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, PathItem.fromJson(e as Map<String, dynamic>)),
),
);
}
Map<String, dynamic> _$OpenAPIToJson(OpenAPI instance) {
final val = <String, dynamic>{
'openapi': instance.version,
'info': instance.info.toJson(),
};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('servers', instance.servers?.map((e) => e.toJson()).toList());
writeNotNull('security', instance.security);
writeNotNull('tags', instance.tags?.map((e) => e.toJson()).toList());
writeNotNull('components', instance.components?.toJson());
writeNotNull('paths', instance.paths?.map((k, e) => MapEntry(k, e.toJson())));
return val;
}

31
packages/dynamite/lib/src/models/operation.dart

@ -0,0 +1,31 @@
import 'package:dynamite/src/models/parameter.dart';
import 'package:dynamite/src/models/request_body.dart';
import 'package:dynamite/src/models/response.dart';
import 'package:dynamite/src/models/responses.dart';
import 'package:json_annotation/json_annotation.dart';
part 'operation.g.dart';
@JsonSerializable()
class Operation {
Operation({
required this.operationId,
required this.tags,
required this.parameters,
required this.requestBody,
required this.responses,
});
factory Operation.fromJson(final Map<String, dynamic> json) => _$OperationFromJson(json);
Map<String, dynamic> toJson() => _$OperationToJson(this);
final String? operationId;
final List<String>? tags;
final List<Parameter>? parameters;
final RequestBody? requestBody;
final Responses? responses;
}

41
packages/dynamite/lib/src/models/operation.g.dart

@ -0,0 +1,41 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'operation.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Operation _$OperationFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['operationId', 'tags', 'parameters', 'requestBody', 'responses'],
);
return Operation(
operationId: json['operationId'] as String?,
tags: (json['tags'] as List<dynamic>?)?.map((e) => e as String).toList(),
parameters:
(json['parameters'] as List<dynamic>?)?.map((e) => Parameter.fromJson(e as Map<String, dynamic>)).toList(),
requestBody: json['requestBody'] == null ? null : RequestBody.fromJson(json['requestBody'] as Map<String, dynamic>),
responses: (json['responses'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, Response.fromJson(e as Map<String, dynamic>)),
),
);
}
Map<String, dynamic> _$OperationToJson(Operation instance) {
final val = <String, dynamic>{};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('operationId', instance.operationId);
writeNotNull('tags', instance.tags);
writeNotNull('parameters', instance.parameters?.map((e) => e.toJson()).toList());
writeNotNull('requestBody', instance.requestBody?.toJson());
writeNotNull('responses', instance.responses?.map((k, e) => MapEntry(k, e.toJson())));
return val;
}

29
packages/dynamite/lib/src/models/parameter.dart

@ -0,0 +1,29 @@
import 'package:dynamite/src/models/schema.dart';
import 'package:json_annotation/json_annotation.dart';
part 'parameter.g.dart';
@JsonSerializable()
class Parameter {
Parameter({
required this.name,
required this.in_,
required this.description,
required this.required,
required this.schema,
});
factory Parameter.fromJson(final Map<String, dynamic> json) => _$ParameterFromJson(json);
Map<String, dynamic> toJson() => _$ParameterToJson(this);
final String name;
@JsonKey(name: 'in')
final String in_;
final String? description;
final bool? required;
final Schema? schema;
}

39
packages/dynamite/lib/src/models/parameter.g.dart

@ -0,0 +1,39 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'parameter.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Parameter _$ParameterFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['name', 'in', 'description', 'required', 'schema'],
);
return Parameter(
name: json['name'] as String,
in_: json['in'] as String,
description: json['description'] as String?,
required: json['required'] as bool?,
schema: json['schema'] == null ? null : Schema.fromJson(json['schema'] as Map<String, dynamic>),
);
}
Map<String, dynamic> _$ParameterToJson(Parameter instance) {
final val = <String, dynamic>{
'name': instance.name,
'in': instance.in_,
};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('description', instance.description);
writeNotNull('required', instance.required);
writeNotNull('schema', instance.schema?.toJson());
return val;
}

68
packages/dynamite/lib/src/models/path_item.dart

@ -0,0 +1,68 @@
import 'package:dynamite/src/models/operation.dart';
import 'package:dynamite/src/models/parameter.dart';
import 'package:json_annotation/json_annotation.dart';
part 'path_item.g.dart';
@JsonSerializable()
class PathItem {
PathItem({
required this.description,
required this.parameters,
required this.get,
required this.put,
required this.post,
required this.delete,
required this.options,
required this.head,
required this.patch,
required this.trace,
});
factory PathItem.fromJson(final Map<String, dynamic> json) => _$PathItemFromJson(json);
Map<String, dynamic> toJson() => _$PathItemToJson(this);
final String? description;
final List<Parameter>? parameters;
final Operation? get;
final Operation? put;
final Operation? post;
final Operation? delete;
final Operation? options;
final Operation? head;
final Operation? patch;
final Operation? trace;
Map<String, Operation> get operations => <String, Operation>{
if (get != null) 'get': get!,
if (put != null) 'put': put!,
if (post != null) 'post': post!,
if (delete != null) 'delete': delete!,
if (options != null) 'options': options!,
if (head != null) 'head': head!,
if (patch != null) 'patch': patch!,
if (trace != null) 'trace': trace!,
};
PathItem copyWithOperations(final Map<String, Operation> operations) => PathItem(
description: description,
parameters: parameters,
get: operations['get'] ?? get,
put: operations['put'] ?? put,
post: operations['post'] ?? post,
delete: operations['delete'] ?? delete,
options: operations['options'] ?? options,
head: operations['head'] ?? head,
patch: operations['patch'] ?? patch,
trace: operations['trace'] ?? trace,
);
}

60
packages/dynamite/lib/src/models/path_item.g.dart

@ -0,0 +1,60 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'path_item.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
PathItem _$PathItemFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const [
'description',
'parameters',
'get',
'put',
'post',
'delete',
'options',
'head',
'patch',
'trace'
],
);
return PathItem(
description: json['description'] as String?,
parameters:
(json['parameters'] as List<dynamic>?)?.map((e) => Parameter.fromJson(e as Map<String, dynamic>)).toList(),
get: json['get'] == null ? null : Operation.fromJson(json['get'] as Map<String, dynamic>),
put: json['put'] == null ? null : Operation.fromJson(json['put'] as Map<String, dynamic>),
post: json['post'] == null ? null : Operation.fromJson(json['post'] as Map<String, dynamic>),
delete: json['delete'] == null ? null : Operation.fromJson(json['delete'] as Map<String, dynamic>),
options: json['options'] == null ? null : Operation.fromJson(json['options'] as Map<String, dynamic>),
head: json['head'] == null ? null : Operation.fromJson(json['head'] as Map<String, dynamic>),
patch: json['patch'] == null ? null : Operation.fromJson(json['patch'] as Map<String, dynamic>),
trace: json['trace'] == null ? null : Operation.fromJson(json['trace'] as Map<String, dynamic>),
);
}
Map<String, dynamic> _$PathItemToJson(PathItem instance) {
final val = <String, dynamic>{};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('description', instance.description);
writeNotNull('parameters', instance.parameters?.map((e) => e.toJson()).toList());
writeNotNull('get', instance.get?.toJson());
writeNotNull('put', instance.put?.toJson());
writeNotNull('post', instance.post?.toJson());
writeNotNull('delete', instance.delete?.toJson());
writeNotNull('options', instance.options?.toJson());
writeNotNull('head', instance.head?.toJson());
writeNotNull('patch', instance.patch?.toJson());
writeNotNull('trace', instance.trace?.toJson());
return val;
}

3
packages/dynamite/lib/src/models/paths.dart

@ -0,0 +1,3 @@
import 'package:dynamite/src/models/path_item.dart';
typedef Paths = Map<String, PathItem>;

22
packages/dynamite/lib/src/models/request_body.dart

@ -0,0 +1,22 @@
import 'package:dynamite/src/models/media_type.dart';
import 'package:json_annotation/json_annotation.dart';
part 'request_body.g.dart';
@JsonSerializable()
class RequestBody {
RequestBody({
required this.description,
required this.content,
required this.required,
});
factory RequestBody.fromJson(final Map<String, dynamic> json) => _$RequestBodyFromJson(json);
Map<String, dynamic> toJson() => _$RequestBodyToJson(this);
final String? description;
final Map<String, MediaType>? content;
final bool? required;
}

36
packages/dynamite/lib/src/models/request_body.g.dart

@ -0,0 +1,36 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'request_body.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
RequestBody _$RequestBodyFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['description', 'content', 'required'],
);
return RequestBody(
description: json['description'] as String?,
content: (json['content'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, MediaType.fromJson(e as Map<String, dynamic>)),
),
required: json['required'] as bool?,
);
}
Map<String, dynamic> _$RequestBodyToJson(RequestBody instance) {
final val = <String, dynamic>{};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('description', instance.description);
writeNotNull('content', instance.content?.map((k, e) => MapEntry(k, e.toJson())));
writeNotNull('required', instance.required);
return val;
}

19
packages/dynamite/lib/src/models/response.dart

@ -0,0 +1,19 @@
import 'package:dynamite/src/models/media_type.dart';
import 'package:json_annotation/json_annotation.dart';
part 'response.g.dart';
@JsonSerializable()
class Response {
Response({
required this.description,
required this.content,
});
factory Response.fromJson(final Map<String, dynamic> json) => _$ResponseFromJson(json);
Map<String, dynamic> toJson() => _$ResponseToJson(this);
final String description;
final Map<String, MediaType>? content;
}

35
packages/dynamite/lib/src/models/response.g.dart

@ -0,0 +1,35 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'response.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Response _$ResponseFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['description', 'content'],
);
return Response(
description: json['description'] as String,
content: (json['content'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, MediaType.fromJson(e as Map<String, dynamic>)),
),
);
}
Map<String, dynamic> _$ResponseToJson(Response instance) {
final val = <String, dynamic>{
'description': instance.description,
};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('content', instance.content?.map((k, e) => MapEntry(k, e.toJson())));
return val;
}

3
packages/dynamite/lib/src/models/responses.dart

@ -0,0 +1,3 @@
import 'package:dynamite/src/models/response.dart';
typedef Responses = Map<String, Response>;

53
packages/dynamite/lib/src/models/schema.dart

@ -0,0 +1,53 @@
import 'package:json_annotation/json_annotation.dart';
part 'schema.g.dart';
@JsonSerializable()
class Schema {
Schema({
required this.ref,
required this.oneOf,
required this.anyOf,
required this.allOf,
required this.description,
required this.deprecated,
required this.type,
required this.format,
required this.default_,
required this.enum_,
required this.properties,
required this.items,
});
factory Schema.fromJson(final Map<String, dynamic> json) => _$SchemaFromJson(json);
Map<String, dynamic> toJson() => _$SchemaToJson(this);
@JsonKey(name: r'$ref')
final String? ref;
final List<Schema>? oneOf;
final List<Schema>? anyOf;
final List<Schema>? allOf;
List<Schema>? get ofs => oneOf ?? anyOf ?? allOf;
final String? description;
final bool? deprecated;
final String? type;
final String? format;
@JsonKey(name: 'default')
final dynamic default_;
@JsonKey(name: 'enum')
final List<dynamic>? enum_;
final Map<String, Schema>? properties;
final Schema? items;
}

67
packages/dynamite/lib/src/models/schema.g.dart

@ -0,0 +1,67 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'schema.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Schema _$SchemaFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const [
r'$ref',
'oneOf',
'anyOf',
'allOf',
'description',
'deprecated',
'type',
'format',
'default',
'enum',
'properties',
'items'
],
);
return Schema(
ref: json[r'$ref'] as String?,
oneOf: (json['oneOf'] as List<dynamic>?)?.map((e) => Schema.fromJson(e as Map<String, dynamic>)).toList(),
anyOf: (json['anyOf'] as List<dynamic>?)?.map((e) => Schema.fromJson(e as Map<String, dynamic>)).toList(),
allOf: (json['allOf'] as List<dynamic>?)?.map((e) => Schema.fromJson(e as Map<String, dynamic>)).toList(),
description: json['description'] as String?,
deprecated: json['deprecated'] as bool?,
type: json['type'] as String?,
format: json['format'] as String?,
default_: json['default'],
enum_: json['enum'] as List<dynamic>?,
properties: (json['properties'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, Schema.fromJson(e as Map<String, dynamic>)),
),
items: json['items'] == null ? null : Schema.fromJson(json['items'] as Map<String, dynamic>),
);
}
Map<String, dynamic> _$SchemaToJson(Schema instance) {
final val = <String, dynamic>{};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull(r'$ref', instance.ref);
writeNotNull('oneOf', instance.oneOf?.map((e) => e.toJson()).toList());
writeNotNull('anyOf', instance.anyOf?.map((e) => e.toJson()).toList());
writeNotNull('allOf', instance.allOf?.map((e) => e.toJson()).toList());
writeNotNull('description', instance.description);
writeNotNull('deprecated', instance.deprecated);
writeNotNull('type', instance.type);
writeNotNull('format', instance.format);
writeNotNull('default', instance.default_);
writeNotNull('enum', instance.enum_);
writeNotNull('properties', instance.properties?.map((k, e) => MapEntry(k, e.toJson())));
writeNotNull('items', instance.items?.toJson());
return val;
}

1
packages/dynamite/lib/src/models/security_requirement.dart

@ -0,0 +1 @@
typedef SecurityRequirement = Map<String, List<String>>;

19
packages/dynamite/lib/src/models/security_scheme.dart

@ -0,0 +1,19 @@
import 'package:json_annotation/json_annotation.dart';
part 'security_scheme.g.dart';
@JsonSerializable()
class SecurityScheme {
SecurityScheme({
required this.type,
required this.description,
required this.scheme,
});
factory SecurityScheme.fromJson(final Map<String, dynamic> json) => _$SecuritySchemeFromJson(json);
Map<String, dynamic> toJson() => _$SecuritySchemeToJson(this);
final String type;
final String? description;
final String? scheme;
}

35
packages/dynamite/lib/src/models/security_scheme.g.dart

@ -0,0 +1,35 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'security_scheme.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
SecurityScheme _$SecuritySchemeFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['type', 'description', 'scheme'],
);
return SecurityScheme(
type: json['type'] as String,
description: json['description'] as String?,
scheme: json['scheme'] as String?,
);
}
Map<String, dynamic> _$SecuritySchemeToJson(SecurityScheme instance) {
final val = <String, dynamic>{
'type': instance.type,
};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('description', instance.description);
writeNotNull('scheme', instance.scheme);
return val;
}

19
packages/dynamite/lib/src/models/server.dart

@ -0,0 +1,19 @@
import 'package:dynamite/src/models/server_variable.dart';
import 'package:json_annotation/json_annotation.dart';
part 'server.g.dart';
@JsonSerializable()
class Server {
Server({
required this.url,
required this.variables,
});
factory Server.fromJson(final Map<String, dynamic> json) => _$ServerFromJson(json);
Map<String, dynamic> toJson() => _$ServerToJson(this);
final String url;
final Map<String, ServerVariable>? variables;
}

35
packages/dynamite/lib/src/models/server.g.dart

@ -0,0 +1,35 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'server.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Server _$ServerFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['url', 'variables'],
);
return Server(
url: json['url'] as String,
variables: (json['variables'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, ServerVariable.fromJson(e as Map<String, dynamic>)),
),
);
}
Map<String, dynamic> _$ServerToJson(Server instance) {
final val = <String, dynamic>{
'url': instance.url,
};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('variables', instance.variables?.map((k, e) => MapEntry(k, e.toJson())));
return val;
}

23
packages/dynamite/lib/src/models/server_variable.dart

@ -0,0 +1,23 @@
import 'package:json_annotation/json_annotation.dart';
part 'server_variable.g.dart';
@JsonSerializable()
class ServerVariable {
ServerVariable({
required this.default_,
required this.enum_,
required this.description,
});
factory ServerVariable.fromJson(final Map<String, dynamic> json) => _$ServerVariableFromJson(json);
Map<String, dynamic> toJson() => _$ServerVariableToJson(this);
@JsonKey(name: 'default')
final String default_;
@JsonKey(name: 'enum')
final List<String>? enum_;
final String? description;
}

35
packages/dynamite/lib/src/models/server_variable.g.dart

@ -0,0 +1,35 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'server_variable.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ServerVariable _$ServerVariableFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['default', 'enum', 'description'],
);
return ServerVariable(
default_: json['default'] as String,
enum_: (json['enum'] as List<dynamic>?)?.map((e) => e as String).toList(),
description: json['description'] as String?,
);
}
Map<String, dynamic> _$ServerVariableToJson(ServerVariable instance) {
final val = <String, dynamic>{
'default': instance.default_,
};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('enum', instance.enum_);
writeNotNull('description', instance.description);
return val;
}

15
packages/dynamite/lib/src/models/tag.dart

@ -0,0 +1,15 @@
import 'package:json_annotation/json_annotation.dart';
part 'tag.g.dart';
@JsonSerializable()
class Tag {
Tag({
required this.name,
});
factory Tag.fromJson(final Map<String, dynamic> json) => _$TagFromJson(json);
Map<String, dynamic> toJson() => _$TagToJson(this);
final String name;
}

21
packages/dynamite/lib/src/models/tag.g.dart

@ -0,0 +1,21 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'tag.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Tag _$TagFromJson(Map<String, dynamic> json) {
$checkKeys(
json,
allowedKeys: const ['name'],
);
return Tag(
name: json['name'] as String,
);
}
Map<String, dynamic> _$TagToJson(Tag instance) => <String, dynamic>{
'name': instance.name,
};

1244
packages/dynamite/lib/src/openapi_builder.dart

File diff suppressed because it is too large Load Diff

7
packages/dynamite/mono_pkg.yaml

@ -0,0 +1,7 @@
sdk:
- stable
stages:
- analyze:
- analyze: --fatal-infos .
- format: --output=none --set-exit-if-changed --line-length 120 .

20
packages/dynamite/pubspec.yaml

@ -0,0 +1,20 @@
name: dynamite
version: 1.0.0
environment:
sdk: '>=2.18.0 <3.0.0'
dependencies:
build: ^2.3.1
code_builder: ^4.3.0
dart_style: ^2.2.4
json_annotation: ^4.6.0
path: ^1.8.2
dev_dependencies:
build_runner: ^2.2.1
json_serializable: ^6.3.2
nit_picking:
git:
url: https://github.com/stack11/dart_nit_picking
ref: f29382f

1
tool/.gitattributes vendored

@ -0,0 +1 @@
ci.sh -diff

8
tool/ci.sh

@ -68,13 +68,13 @@ for PKG in ${PKGS}; do
echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m" echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m"
case ${TASK} in case ${TASK} in
analyze_0) analyze_0)
echo 'flutter analyze --fatal-infos .'
flutter analyze --fatal-infos . || EXIT_CODE=$?
;;
analyze_1)
echo 'dart analyze --fatal-infos .' echo 'dart analyze --fatal-infos .'
dart analyze --fatal-infos . || EXIT_CODE=$? dart analyze --fatal-infos . || EXIT_CODE=$?
;; ;;
analyze_1)
echo 'flutter analyze --fatal-infos .'
flutter analyze --fatal-infos . || EXIT_CODE=$?
;;
format) format)
echo 'dart format --output=none --set-exit-if-changed --line-length 120 .' echo 'dart format --output=none --set-exit-if-changed --line-length 120 .'
dart format --output=none --set-exit-if-changed --line-length 120 . || EXIT_CODE=$? dart format --output=none --set-exit-if-changed --line-length 120 . || EXIT_CODE=$?

Loading…
Cancel
Save