Search by

solido / smithy

Smithy model generation from Solido DTO metadata.

Maintainers

Package info

github.com/solid-o/smithy

pkg:composer/solido/smithy

Transparency log

Statistics

Installs: 2

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-09-05 08:43 UTC

This package is auto-updated.

Last update: 2026-09-05 08:44:06 UTC


README

Generates Smithy models from Solido DTO metadata.

This package is currently experimental. It provides package-owned Smithy metadata attributes, a DTO metadata extractor, a small intermediate API model, optional Symfony route operation extraction, and a deterministic Smithy IDL renderer.

Installation

composer require solido/smithy

Usage

use Solido\Smithy\Extractor\DtoMetadataExtractor;
use Solido\Smithy\GeneratorConfig;
use Solido\Smithy\Renderer\SmithyIdlRenderer;
use Solido\Smithy\SmithyGenerator;
use Solido\Smithy\Type\TypeOverride;

$generator = new SmithyGenerator(
    new DtoMetadataExtractor($resolver),
    new SmithyIdlRenderer(),
);

$smithy = $generator->generate(new GeneratorConfig(
    namespace: 'com.example.api',
    serviceName: 'ExampleService',
    dtoNamespaces: ['App\\DTO'],
    typeOverrides: [
        TypeOverride::type(App\ValueObject\UserId::class, 'String'),
        TypeOverride::member(App\DTO\v1\v1_0\User::class, 'id', 'smithy.api#String'),
    ],
));

Use generateResult() when diagnostics or the intermediate model are needed:

$result = $generator->generateResult(new GeneratorConfig(
    namespace: 'com.example.api',
    serviceName: 'ExampleService',
    dtoNamespaces: ['App\\DTO'],
));

foreach ($result->diagnostics() as $diagnostic) {
    // Surface warnings in CI or in an application command.
}

CLI

vendor/bin/solido-smithy \
  --namespace=com.example.api \
  --service-name=ExampleService \
  --dto-namespace='App\DTO' \
  --output=build/smithy/model.smithy

Supported Metadata

  • Solido\Smithy\Attribute\HttpHeader
  • Solido\Smithy\Attribute\HttpLabel
  • Solido\Smithy\Attribute\HttpPayload
  • Solido\Smithy\Attribute\IgnoreInput
  • Solido\Smithy\Attribute\IgnoreOutput
  • Solido\Smithy\Attribute\InputName
  • Solido\Smithy\Attribute\ListOutput
  • Solido\Smithy\Attribute\MemberName
  • Solido\Smithy\Attribute\SolidoList
  • type overrides configured with Solido\Smithy\Type\TypeOverride
  • PHPDoc list types such as Project[], rendered as Smithy list shapes when the element class can be resolved
  • Symfony #[Route] attributes, when symfony/routing is installed
  • KCS serializer SerializedName, Exclude, and VirtualProperty attributes, when kcs/serializer is installed
  • Symfony validator NotBlank and NotNull constraints, when symfony/validator is installed