Class ScaffoldSpec

Namespace
Kuestenlogik.Bowire.Scaffold
Assembly
Kuestenlogik.Bowire.Scaffold.dll

What a scaffold is generated from (#177): one entity, its fields, and the protocol to serve it over. Written by the AI assistant from a sentence, by ScaffoldIntentParser without a model, or by hand.

public sealed record ScaffoldSpec : IEquatable<ScaffoldSpec>
Inheritance
ScaffoldSpec
Implements
Inherited Members

Constructors

ScaffoldSpec(string, string, IReadOnlyList<ScaffoldField>, string?, string?)

What a scaffold is generated from (#177): one entity, its fields, and the protocol to serve it over. Written by the AI assistant from a sentence, by ScaffoldIntentParser without a model, or by hand.

public ScaffoldSpec(string Entity, string Protocol, IReadOnlyList<ScaffoldField> Fields, string? Service = null, string? BaseUrl = null)

Parameters

Entity string

The entity, singular — User.

Protocol string

rest (OpenAPI 3 + minimal API) or grpc (proto3 + Grpc.AspNetCore).

Fields IReadOnlyList<ScaffoldField>

The entity's fields besides id, which every entity gets.

Service string

The service name; defaults to the entity's plural — Users.

BaseUrl string

Where the stub listens; default http://localhost:5000.

Fields

MaxFields

The most fields one entity may carry.

public const int MaxFields = 40

Field Value

int

Protocols

The protocols a scaffold can target.

public static readonly IReadOnlyList<string> Protocols

Field Value

IReadOnlyList<string>

Types

The field types a spec may use.

public static readonly IReadOnlyList<string> Types

Field Value

IReadOnlyList<string>

Properties

BaseUrl

Where the stub listens; default http://localhost:5000.

[JsonPropertyName("baseUrl")]
public string? BaseUrl { get; init; }

Property Value

string

Entity

The entity, singular — User.

[JsonPropertyName("entity")]
public string Entity { get; init; }

Property Value

string

Fields

The entity's fields besides id, which every entity gets.

[JsonPropertyName("fields")]
public IReadOnlyList<ScaffoldField> Fields { get; init; }

Property Value

IReadOnlyList<ScaffoldField>

Protocol

rest (OpenAPI 3 + minimal API) or grpc (proto3 + Grpc.AspNetCore).

[JsonPropertyName("protocol")]
public string Protocol { get; init; }

Property Value

string

Service

The service name; defaults to the entity's plural — Users.

[JsonPropertyName("service")]
public string? Service { get; init; }

Property Value

string

Methods

Deconstruct(out string, out string, out IReadOnlyList<ScaffoldField>, out string?, out string?)

public void Deconstruct(out string Entity, out string Protocol, out IReadOnlyList<ScaffoldField> Fields, out string? Service, out string? BaseUrl)

Parameters

Entity string
Protocol string
Fields IReadOnlyList<ScaffoldField>
Service string
BaseUrl string

Equals(ScaffoldSpec?)

public bool Equals(ScaffoldSpec? other)

Parameters

other ScaffoldSpec

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Normalize()

The spec with names brought into shape — entity PascalCase and singular, fields camelCase, type aliases resolved, a field called id dropped (every entity has one) — or the list of what cannot be fixed. Generation only ever sees a normalized spec.

public (ScaffoldSpec? Spec, IReadOnlyList<string> Errors) Normalize()

Returns

(ScaffoldSpec Spec, IReadOnlyList<string> Notes)

ToString()

public override string ToString()

Returns

string

Operators

operator ==(ScaffoldSpec?, ScaffoldSpec?)

public static bool operator ==(ScaffoldSpec? left, ScaffoldSpec? right)

Parameters

left ScaffoldSpec
right ScaffoldSpec

Returns

bool

operator !=(ScaffoldSpec?, ScaffoldSpec?)

public static bool operator !=(ScaffoldSpec? left, ScaffoldSpec? right)

Parameters

left ScaffoldSpec
right ScaffoldSpec

Returns

bool