anz-bank / sysl

Sysl (pronounced "sizzle") is a system specification language
https://sysl.io
Apache License 2.0
122 stars 42 forks source link

Example in documentation fails #1057

Open behrangsa opened 3 years ago

behrangsa commented 3 years ago

Description

The example here fails with an error:

Sysl spec:

# The fantastic Hello World greeting system.

HelloService:
    /greeting/{userId <: int}:
        GET:
            ...

Hello App:
    Greet:
        HelloService <- GET /greeting/{userId <: int}

Running sysl:

$ sysl sd --endpoint="Hello App <- Greet" hello.sysl
WARN[0000] lint hello.sysl:10:8: Endpoint '/greeting/{userId <: int}' does not exist for call 'HelloService <- GET /greeting/{userId <: int}' 
panic: endpoint "GET /greeting/{userId <: int}" not found in app "HelloService"

goroutine 1 [running]:
github.com/anz-bank/sysl/pkg/cmdutils.(*EndpointElement).endpoint(0xc000ab1a90, 0xc000cf8160, 0xc000cf8160)
        /sysl/pkg/cmdutils/visitor.go:138 +0x150
github.com/anz-bank/sysl/pkg/cmdutils.(*SequenceDiagramVisitor).visitEndpoint(0xc0006ec930, 0xc000ab1a90, 0xc000e4eb28, 0x40dbf6)
        /sysl/pkg/cmdutils/visitor.go:356 +0x107
github.com/anz-bank/sysl/pkg/cmdutils.(*SequenceDiagramVisitor).Visit(0xc0006ec930, 0x1a02f20, 0xc000ab1a90, 0xc00024cf00, 0x0)
        /sysl/pkg/cmdutils/visitor.go:246 +0x2b9
github.com/anz-bank/sysl/pkg/cmdutils.(*EndpointElement).Accept(...)
        /sysl/pkg/cmdutils/visitor.go:112
github.com/anz-bank/sysl/pkg/cmdutils.(*SequenceDiagramVisitor).visitCall(0xc0006ec930, 0xc000902c00, 0x0, 0xc000ec6540, 0xc000434000, 0x203000)
        /sysl/pkg/cmdutils/visitor.go:506 +0x325
github.com/anz-bank/sysl/pkg/cmdutils.(*SequenceDiagramVisitor).visitStatment(0xc0006ec930, 0xc000902c00, 0xc000e4ed08, 0x40dbf6)
        /sysl/pkg/cmdutils/visitor.go:457 +0x2cb
github.com/anz-bank/sysl/pkg/cmdutils.(*SequenceDiagramVisitor).Visit(0xc0006ec930, 0x1a03020, 0xc000902c00, 0x12, 0xc000a52a48)
        /sysl/pkg/cmdutils/visitor.go:248 +0x28d
github.com/anz-bank/sysl/pkg/cmdutils.(*StatementElement).Accept(...)
        /sysl/pkg/cmdutils/visitor.go:192
github.com/anz-bank/sysl/pkg/cmdutils.(*SequenceDiagramVisitor).visitEndpoint(0xc0006ec930, 0xc000ab1a40, 0xc000e4efd8, 0x40dbf6)
        /sysl/pkg/cmdutils/visitor.go:438 +0xb8b
github.com/anz-bank/sysl/pkg/cmdutils.(*SequenceDiagramVisitor).Visit(0xc0006ec930, 0x1a02f20, 0xc000ab1a40, 0xc00024cc30, 0xc000a52638)
        /sysl/pkg/cmdutils/visitor.go:246 +0x2b9
github.com/anz-bank/sysl/pkg/cmdutils.(*EndpointElement).Accept(...)
        /sysl/pkg/cmdutils/visitor.go:112
github.com/anz-bank/sysl/pkg/cmdutils.(*SequenceDiagramVisitor).visitEndpointCollection(0xc0006ec930, 0xc0005abe00, 0x0, 0xc00024c960)
        /sysl/pkg/cmdutils/visitor.go:329 +0x7cc
github.com/anz-bank/sysl/pkg/cmdutils.(*SequenceDiagramVisitor).Visit(0xc0006ec930, 0x1a02f00, 0xc0005abe00, 0x1, 0x1)
        /sysl/pkg/cmdutils/visitor.go:239 +0xd4
github.com/anz-bank/sysl/pkg/cmdutils.(*EndpointCollectionElement).Accept(...)
        /sysl/pkg/cmdutils/visitor.go:82
github.com/anz-bank/sysl/pkg/sequencediagram.GenerateSequenceDiag(0xc000581540, 0xc0006ec8c0, 0xc00014c3f0, 0x2, 0x2, 0xc00055ae00, 0x14)
        /sysl/pkg/sequencediagram/sequencediagram.go:33 +0x31d
github.com/anz-bank/sysl/pkg/sequencediagram.DoConstructSequenceDiagrams(0xc000e4fb50, 0xc000581540, 0xc00014c3f0, 0xc000ec4678, 0x0, 0x0)
        /sysl/pkg/sequencediagram/sequencediagram.go:161 +0x12cc
main.(*sequenceDiagramCmd).Execute(0xc000ba6640, 0x16eb1f1, 0x2, 0xc000ec4678, 0x1, 0x1, 0x1a3e700, 0x2822260, 0xc00014c3f0, 0xc000c735c0, ...)
        /sysl/cmd/sysl/cmd_sequencediagram.go:84 +0x165
main.(*cmdRunner).Run(0xc0005c7470, 0x16eb1f1, 0x2, 0x1a3e700, 0x2822260, 0xc00014c3f0, 0x0, 0x0)
        /sysl/cmd/sysl/cmd_runner.go:51 +0x60f
main.main3(0xc00003c0c0, 0x4, 0x4, 0x1a3e700, 0x2822260, 0xc00014c3f0, 0x0, 0xc000c47e80)
        /sysl/cmd/sysl/sysl.go:46 +0x307
main.main2(0xc00003c0c0, 0x4, 0x4, 0x1a3e700, 0x2822260, 0xc00014c3f0, 0x183fe70, 0xc0000400b8)
        /sysl/cmd/sysl/sysl.go:91 +0x89
main.main()
        /sysl/cmd/sysl/sysl.go:109 +0x79

Steps to Reproduce

  1. Run the example from the documentation

Expected behavior

A diagram to be generated.

Actual behavior

➜ sysl sd --endpoint="Hello App <- Greet" hello.sysl
WARN[0000] lint hello.sysl:10:8: Endpoint '/greeting/{userId <: int}' does not exist for call 'HelloService <- GET /greeting/{userId <: int}' 
panic: endpoint "GET /greeting/{userId <: int}" not found in app "HelloService"

goroutine 1 [running]:

Your Environment

$ sysl info
➜ sysl info
Build:
  Version      : 
  Git Commit   : 
  Date         : 2021-02-24T06:52:41Z
  Go Version   : go1.13.8 linux/amd64
  OS           : linux/amd64