dryvPacks

@dryv/actix-web-backendv0.1.0

Actix Web handlers with shared serde models and separated async services.

Actix Web BackendBackendUnitPublished 7 days ago2 downloads

dryv pack add @dryv/actix-web-backend
1.9 KBRaw ↗
yaml
version: dryv.pack/v1alpha1
key: unit.backend.actix-web-backend
layout: unit
package:
  name: { $ref: "#/inputs/crate_name" }

source: templates

info:
  title: Actix Web Backend
  version: 0.1.0
  description: Generates Actix Web 4.15 handlers, serde models and feature service traits.

  purpose: backend
  summary: Actix Web handlers with shared serde models and separated async services.
  languages: [rust]
  frameworks: [actix-web, serde]
  tags: [backend, rest, http, rust]

plugins:
  - name: jinja
    extensions: [.j2]

inputs:
  crate_name:
    type: string
    default: dryv_actix_backend
    description: Cargo package name for the generated backend library.

selections:
  enums:
    subject: property.enum
    scope: each

  models:
    subject: schema
    scope: each

  routes:
    subject: operation
    filter:
      all: { facet: http }
    scope: collects.feature

templates:
  enum:
    $ref: "#/selections/enums"
    output:
      name: $(group.name.snake)_$(subject.name.snake)
      symbol: $(group.name.pascal)$(subject.name.pascal)

  model:
    $ref: "#/selections/models"
    output:
      name: $(group.name.snake)_$(subject.name.snake)
      symbol: $(group.name.pascal)$(subject.name.pascal)
    imports:
      - $ref: "#/templates/enum"
      - $ref: "#/templates/model"

  route:
    $ref: "#/selections/routes"
    output:
      name: $(group.name.snake)_$(feature.name.snake)
      symbols:
        service: $(group.name.pascal)$(feature.name.pascal)Service
        configure: configure_$(group.name.snake)_$(feature.name.snake)
    imports:
      - $ref: "#/templates/enum"
      - $ref: "#/templates/model"

  models-index:
    exports:
      - $ref: "#/templates/enum"
      - $ref: "#/templates/model"

  routes-index:
    exports:
      - $ref: "#/templates/route"

provides:
  schema.types:
    $ref: "#/templates/model"
  property.enum.types:
    $ref: "#/templates/enum"