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
EntitystringThe entity, singular —
User.Protocolstringrest(OpenAPI 3 + minimal API) orgrpc(proto3 + Grpc.AspNetCore).FieldsIReadOnlyList<ScaffoldField>The entity's fields besides
id, which every entity gets.ServicestringThe service name; defaults to the entity's plural —
Users.BaseUrlstringWhere the stub listens; default
http://localhost:5000.
Fields
MaxFields
The most fields one entity may carry.
public const int MaxFields = 40
Field Value
Protocols
The protocols a scaffold can target.
public static readonly IReadOnlyList<string> Protocols
Field Value
Types
The field types a spec may use.
public static readonly IReadOnlyList<string> Types
Field Value
Properties
BaseUrl
Where the stub listens; default http://localhost:5000.
[JsonPropertyName("baseUrl")]
public string? BaseUrl { get; init; }
Property Value
Entity
The entity, singular — User.
[JsonPropertyName("entity")]
public string Entity { get; init; }
Property Value
Fields
The entity's fields besides id, which every entity gets.
[JsonPropertyName("fields")]
public IReadOnlyList<ScaffoldField> Fields { get; init; }
Property Value
Protocol
rest (OpenAPI 3 + minimal API) or grpc (proto3 + Grpc.AspNetCore).
[JsonPropertyName("protocol")]
public string Protocol { get; init; }
Property Value
Service
The service name; defaults to the entity's plural — Users.
[JsonPropertyName("service")]
public string? Service { get; init; }
Property Value
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
EntitystringProtocolstringFieldsIReadOnlyList<ScaffoldField>ServicestringBaseUrlstring
Equals(ScaffoldSpec?)
public bool Equals(ScaffoldSpec? other)
Parameters
otherScaffoldSpec
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
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
ToString()
public override string ToString()
Returns
Operators
operator ==(ScaffoldSpec?, ScaffoldSpec?)
public static bool operator ==(ScaffoldSpec? left, ScaffoldSpec? right)
Parameters
leftScaffoldSpecrightScaffoldSpec
Returns
operator !=(ScaffoldSpec?, ScaffoldSpec?)
public static bool operator !=(ScaffoldSpec? left, ScaffoldSpec? right)
Parameters
leftScaffoldSpecrightScaffoldSpec