pdevito3 / craftsman

A .NET scaffolding tool to help you stop worrying about boilerplate and focus on your business logic 🚀
https://wrapt.dev
MIT License
1.12k stars 65 forks source link

CanFilter and CanSort properties incorrectly documented in Tutorial #123

Closed AlexanderNZ closed 1 year ago

AlexanderNZ commented 1 year ago

In the tutorial page (https://wrapt.dev/docs/tutorial#adding-a-new-bounded-context) there is a bounded context entity declaration that looks like this:

      - Name: ShoppingList
        Features:
          - Type: AddRecord
          - Type: GetRecord
          - Type: GetList
          - Type: UpdateRecord
          - Type: DeleteRecord
        Properties:
          - Name: Store
            Type: string
            CanFilter: true
            CanSort: true

Using the CanFilter and CanSort flags causes a deserialisation error - Error: (Line: 21, Col: 13, Idx: 532) - (Line: 21, Col: 13, Idx: 532): Exception during deserialization

Removing these fields fixes the issue - Also I can see the fields in the tutorial but not in the docs themselves, so might just be inconsistent docs rather than a real error.

Steps to reproduce

Create a file named poc.yml with contents:

DomainName: poc
BoundedContexts:
    - ProjectName: HumanContext
      Port: 8081
      DbContext:
        ContextName: HumanDbContext
        DatabaseName: HumanReadModel
        Provider: postgres
        NamingConvention: CamelCase
      Entities:
        - Name: Human
          Features:
            - Type: AddRecord
            - Type: GetRecord
            - Type: GetList
            - Type: UpdateRecord
            - Type: DeleteRecord
          Properties:
          - Name: PropertyName
            Type: string
            IsRequired: true
            CanFilter: true
            CanSort: true
          - Name: lastName
            Type: string
            IsRequired: true
          - Name: irdNumber
            Type: int
            IsRequired: false
          - Name: activeContracts
            Relationship: 1tomany
            ForeignEntityName: Contract
            ForeignEntityPlural: Contracts
        - Name: Contract
          Features:
            - Type: AddRecord
            - Type: GetRecord
            - Type: GetList
            - Type: UpdateRecord
            - Type: DeleteRecord
          Properties:
          - Name: jobTitle
            Type: string
            IsRequired: true
          - Name: hourlyRate
            Type: int
            IsRequired: true
          - Name: contractedHoursPerUnitTime
            Type: int
            IsRequired: false
          - Name: unitTime
            SmartNames:
                - week
                - month
                - year

Run craftsman new domain poc.yml This yields Error: (Line: 21, Col: 13, Idx: 532) - (Line: 21, Col: 13, Idx: 532): Exception during deserialization

Comment out or remove

            CanFilter: true
            CanSort: true

Re-run craftsman new domain poc.yml (on Mac I get another error but based on another issue I think this is a post-codegen error and not related to the scaffolding itself). The command should succeed.

Further technical details

Craftsman 0.22.1 Mac Ventura 13.5.1

pdevito3 commented 1 year ago

Thanks for the callout. This is a miss in the docs as those were removed last release. I'll push an update for this soon