You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Library sample: inline produces event, and a rejection spec for every validation rule #630
The model-first Library sample (ModelFirst/Library/library.play) declares its event as a separate block and references it from the command:
produces BookAddedToCatalog
for bookId
title = title
authorName = authorName
event BookAddedToCatalog
title BookTitle
authorName AuthorName
Since Screenplay 4.51, produces event <Name> declares the event inline with each property typed and mapped on one line, and for defaults to the command identifier. That is the preferred form for a new slice-owned event. Update the sample (and its README if it explains events) to:
produces event BookAddedToCatalog
title BookTitle = title
authorName AuthorName = authorName
and keep the specifications passing. Reference: Documentation/screenplay/commands.md#declare-an-event-inline.
While there: AddBook validates authorName not empty but has no rejection specification for it (only RejectingABookWithoutATitle). Add one so every validation rule has a specification:
specification RejectingABookWithoutAnAuthorName
when AddBook
bookId = "69064f39-6a76-458a-8a34-088eb4752650"
title = "The Quiet Archive"
authorName = ""
then error "An author name is required"
Status
State: Done — Merged in #671; closed. Branch: (#671) Scope: L71: Library sample inline produces event + empty-author rejection spec. Delivered: Nothing yet. Remaining: To be confirmed. Follow-ups: None.
changed the title [-]Library sample: declare BookAddedToCatalog inline with produces event[/-][+]Library sample: inline produces event, and a rejection spec for every validation rule[/+]on Oct 13, 2026
Current behaviour — library.play:25–36 validates both title and author name, but produces a separately declared BookAddedToCatalog. Its specifications:38–52 cover acceptance and empty-title rejection only. The README:70–75 still describes two passing examples and offers the missing author-name case as an exercise.
Root cause / gap — The sample predates the preferred inline event form and leaves one declared validation rule without an executable rejection example. The issue's proposed syntax remains correct: Screenplay commands:94–106 documents typed property mappings and omission of for when the command identifier is intended.
Proposed change — Apply the supplied inline produces event BookAddedToCatalog declaration, remove the standalone event block and redundant for bookId, and preserve the existing payload mappings. Add RejectingABookWithoutAnAuthorName with a valid title, empty author name and the exact expected validation message. Keep the accepted and empty-title examples unchanged. Update the source header and README to describe three examples and two rejection cases, including the diagram count; replace the now-completed author-name exercise. Verify compilation without diagnostics and all three model-level specifications using the documented sample workflow. These embedded Screenplay examples are the appropriate specifications here, rather than new C# fixtures.
Size, risk, release intent — S; low risk, with unchanged event identity and payload; patch.
Delivered in #671. ModelFirst/Library/library.play now declares BookAddedToCatalog inline with produces event, and it has a rejection specification for an empty author name next to the empty-title one. The README describes all three specifications.
Activity
[-]Library sample: declare BookAddedToCatalog inline with produces event[/-][+]Library sample: inline produces event, and a rejection spec for every validation rule[/+]woksin commentedon Oct 29, 2026
Analysis and proposed solution
Current behaviour — library.play:25–36 validates both title and author name, but produces a separately declared
BookAddedToCatalog. Its specifications:38–52 cover acceptance and empty-title rejection only. The README:70–75 still describes two passing examples and offers the missing author-name case as an exercise.Root cause / gap — The sample predates the preferred inline event form and leaves one declared validation rule without an executable rejection example. The issue's proposed syntax remains correct: Screenplay commands:94–106 documents typed property mappings and omission of
forwhen the command identifier is intended.Proposed change — Apply the supplied inline
produces event BookAddedToCatalogdeclaration, remove the standalone event block and redundantfor bookId, and preserve the existing payload mappings. AddRejectingABookWithoutAnAuthorNamewith a valid title, empty author name and the exact expected validation message. Keep the accepted and empty-title examples unchanged. Update the source header and README to describe three examples and two rejection cases, including the diagram count; replace the now-completed author-name exercise. Verify compilation without diagnostics and all three model-level specifications using the documented sample workflow. These embedded Screenplay examples are the appropriate specifications here, rather than new C# fixtures.Size, risk, release intent — S; low risk, with unchanged event identity and payload; patch.
Dependencies — None.
woksin commentedon Oct 29, 2026
Delivered in #671.
ModelFirst/Library/library.playnow declaresBookAddedToCataloginline withproduces event, and it has a rejection specification for an empty author name next to the empty-title one. The README describes all three specifications.