Skip to content

Commit

Permalink
Alternative version of findings language without marker interfaces us…
Browse files Browse the repository at this point in the history
…ing enum properties instead.
  • Loading branch information
joswarmer committed Mar 11, 2024
1 parent 24f618b commit fb74246
Show file tree
Hide file tree
Showing 5 changed files with 352 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/alternative/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Findings

This is a reworked findings language (and derivatives) without marker interfaces.
Original ones are in `languages/io.lionweb.serialization.validation/lionweb` and in
`languages/io.lionweb.util.location/lionweb`

`io.lionweb.util.location.puml`: location language, using complete metapointer for feature reference

`io.lionweb.util.findings.puml`: generic findings language, without all the "marker" interfaces.

`io.lionweb.util.serialiation.validation.puml`: validation language, based on the findings language in this folder

`strutural.puml`: teh original 'structural.puml' langauge based on the findings languahge in this folder.
157 changes: 157 additions & 0 deletions docs/alternative/io.lionweb.serialization.validation.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
@startuml

hide empty members

' qualified name: "io.lionweb.serialization.validation"
abstract class Finding <<From Findings>> {
severity: Severity
}

enum Severity <<From Findings>> {
Warning
Error
}

' THE ACTUAL VALIDATION LANGUAGE
enum ValidationLevel {
Json
Structural
Hierarchical
MetaStructural
}

abstract class AValidationFinding extends Finding {
level: ValidationLevel
}
note top
Validation issues should be ablee to refer to nodes,
therefore several string valued properties should actually be node id's
end note

class JsonFinding extends AValidationFinding {
final level = ValidationLevel.Json
message: string
}
note left: Comes from JSON parser, so we only have a string

abstract class AStructuralFinding extends AValidationFinding {
final level = ValidationLevel.Structural
}
abstract class AHierarchicalFinding extends AValidationFinding {
final level = ValidationLevel.Hierarchical
}
' note top: \n\n\n\n\n\n\n\n

abstract class AMetaStructuralFinding extends AValidationFinding {
final level = ValidationLevel.MetaStructural
}

class ChildMissingInParent extends AHierarchicalFinding {
childId: String?
parentId: String?
}

class CircularParent extends AHierarchicalFinding {
}

class DuplicateId extends AStructuralFinding {
id: String?
}

class DuplicateNodeId extends AStructuralFinding {
id: String?
}

class DuplicateUsedLanguages extends AStructuralFinding {
key: String?
version: String?
}

class IdFormat extends AStructuralFinding {
value: String?
}

class KeyFormat extends AStructuralFinding {
value: String?
}

class MemberMissing extends AMetaStructuralFinding {
memberKey: String?
}

class MemberNull extends AStructuralFinding {
memberKey: String?
}

class MemberTypeIncorrectError extends AMetaStructuralFinding {
memberKey: String?
memberValue: String?
expectedMemberType: String?
actualMemberType: String?
}

class MemberUnknown extends AMetaStructuralFinding {
memberKey: String?
memberValue: String?
}

class MemberValueArrayContainsNull extends AStructuralFinding {
memberKey: String?
}

class ParentMissingInChild extends AHierarchicalFinding {
childId: String?
parentId: String?
}

class PropertyMetaPointerNotInClass extends AMetaStructuralFinding {
}

class PropertyValueIncorrect extends AMetaStructuralFinding {
value: String?
}

class SerializationFormatVersion extends AStructuralFinding {
value: String?
}

class UnlistedLanguage extends AStructuralFinding {
}

class VersionFormat extends AStructuralFinding {
value: String?
}

' relations:

AValidationFinding "1" o--> "0..1" ILocation: location

abstract class ILocation <<From Locations>> {
}


























@enduml
38 changes: 38 additions & 0 deletions docs/alternative/io.lionweb.util.findings.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@startuml
hide empty members

' qualified name: "io.lionweb.util.location"

interface ILocation <<From Locations>> {
}
note left
optional, because there is not always
a sensible location to refer to.
end note

abstract class Finding {
severity: Severity
message?: string
}
note left
Should it also has a property "message" for human
readability and/or debugging? For example when
you get findings from an unknown language?
end note
enum Severity {
Info
Warning
Error
}

class GenericFinding extends Finding {
kind: string
message: string
}

' relations:

Finding "1" o--> "0..1" ILocation: location

@enduml

63 changes: 63 additions & 0 deletions docs/alternative/io.lionweb.util.location.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@startuml
hide empty members

' qualified name: "io.lionweb.util.location"


abstract class ATextLocation implements ILocation

class CharacterIndexTextLocation extends ATextLocation {
index: Integer?
}

class CompositeLocation implements ILocation

interface ILocation

class JsonPathLocation implements ILocation {
path: String
}

class LineColumnTextLocation extends ATextLocation {
line?: Integer
column?: Integer
length?: Integer
}

class NodeLocation implements ILocation {
nodeId: String
index?: Integer
}

class NodeFeatureIndexLocation extends NodeFeatureLocation {
index: Integer?
}

class NodeFeatureLocation extends NodeLocation {
featureKey: String?
}

class NodeLocation implements ILocation {
nodeId: String?
}

class MetaPointer {
featureKey?: string
featureLanguage?: string
featureLanguageVersion?: string
}
' relations:


NodeFeatureLocation "*" --> "1" MetaPointer: feature

CompositeLocation "1" o--> "*" ILocation: locations








@enduml
81 changes: 81 additions & 0 deletions docs/alternative/structural2.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
@startuml
hide empty members

' qualified name: "io.lionweb.serialization.validation"

abstract class Finding <<From Findings>> {
severity: Severity
}

enum Severity <<From Findings>> {
Warning
Error
}

class DuplicateId extends Finding {
final severity = Severity.Error
id: String <<optional>>
}

class DuplicateNodeId extends Finding {
final severity = Severity.Error
id: String <<optional>>
}

class DuplicateUsedLanguages extends Finding {
final severity = Severity.Error
key: String <<optional>>
version: String <<optional>>
}

class IdFormat extends Finding {
final severity = Severity.Error
value: String <<optional>>
}

class KeyFormat extends Finding {
final severity = Severity.Error
value: String <<optional>>
}

class MemberMissing extends Finding {
final severity = Severity.Error
memberKey: String <<optional>>
}

class MemberNull extends Finding {
final severity = Severity.Error
memberKey: String <<optional>>
}

class MemberTypeIncorrectError extends Finding {
final severity = Severity.Error
memberKey: String <<optional>>
memberValue: String <<optional>>
expectedMemberType: String <<optional>>
actualMemberType: String <<optional>>
}

class MemberUnknown extends Finding {
final severity = Severity.Warning
memberKey: String <<optional>>
memberValue: String <<optional>>
}

class MemberValueArrayContainsNull extends Finding {
final severity = Severity.Error
memberKey: String <<optional>>
}


class SerializationFormatVersion extends Finding {
final severity = Severity.Error
value: String <<optional>>
}

class VersionFormat extends Finding {
final severity = Severity.Error
value: String <<optional>>
}

@enduml

0 comments on commit fb74246

Please sign in to comment.