# merged.yaml
components:
  schemas:
    serviceA_Pet:
      x-speakeasy-name-override: Pet
      x-speakeasy-model-namespace: serviceA
      type: object
      properties:
        name:
          type: string
    serviceB_Pet:
      x-speakeasy-name-override: Pet
      x-speakeasy-model-namespace: serviceB
      type: object
      properties:
        species:
          type: string
```

For more granular control over which schemas belong to which namespace, apply the `x-speakeasy-model-namespace` extension directly to individual schemas in the OpenAPI document instead of using `modelNamespace` in the workflow file.

### Transformations

Sources can include transformations that modify the OpenAPI document before it's used to generate SDKs. Transformations are applied in order after merging inputs and applying overlays.

```yaml
      # .... more openapi overlays can be added here
    transformations:
      # Remove unused components from the OpenAPI document
      - removeUnused: true
      # Filter to include only specific operations
      - filterOperations:
          operations: getPets, createPet
          include: true
      # General cleanup of the OpenAPI document (formatting and style)
```

### Output

Each source can specify an output location where the merged OpenAPI document will be written.

```yaml
    output: ./merged-openapi.yaml
```

### Registry

Sources can be configured to publish to the API Registry found in the Speakeasy workspace.

```yaml
    registry:
      location: registry.speakeasy.com/my-org/my-api
```

## Targets

Targets can be added to a workflow programmatically `speakeasy configure targets` or manually by editing the workflow file.

### Targets

Targets are the outputs of the workflow. A single Target is a SDK, Terraform or other generated artifact from sources.

```yaml
targets:
  my-target:
    target: python
    source: my-source
    testing:
      enabled: true
      mockServer:
        enabled: false
```

### TargetName

Each Target is given a name. In this example the name is `my-target`. This name is used to reference the target in the workflow file.

```yaml
  my-target:
```

### TargetType

Each Target has a type. The target is the type of artifact that will be generated from the sources. The target can be one of the supported languages [here](/docs/sdks/create-client-sdks)

```yaml
    target: python
```

### TargetSource

Each Target has a source. The source is the name of the source that the target will be generated from.

```yaml
    source: my-source
```

### Testing

Each Target supports enabling testing as part of the workflow, if test generation is licensed. This will run target-specific testing, such as `go test` or `pytest`, after code generation. Use this with CLI-only `speakeasy run` development workflows (instead of separately calling `speakeasy test`) or GitHub Actions `mode: direct` or `mode: test` development workflows to ensure tests are successful with any potential code updates.

```yaml
    testing:
      enabled: true
      mockServer:
        enabled: false
```

### MockServer

Target testing, when licensed and enabled, starts a mock API server automatically as part of the workflow. This disables the mock API server, if the testing should always pointed at a test environment server URL instead.

```yaml
      mockServer:
        enabled: false
```

### CodeSamples

Each target can be configured to generate code samples and publish them to Speakeasy's registry.

```yaml
    codeSamples:
      output: codeSamples.yaml
      registry:
        location: registry.speakeasy.com/my-org/my-api/code-samples
```