Skip to content

tagging an undefined "rel" per default as "alternate" #7

@allixender

Description

@allixender

There is a bug in the Owc GeoJson Scala Play JSON lib, that tags an undefined rel default as "alternate". Actually we don't need the rel attribute immediately in the JSON encoding, and we can use the uuid to store and easily distinguish which OwcLink goes into what List (contentByRef, ResourceMetadata and similar), but for e.g. for a subsequent parallel support of OGC OWC ATOM encoding we also need to keep the rels proper:

It needs to be added to the OwcContext and OwcResource JSON parsers, to send default "rel" depending for which JSON path they are parsing:
some Pseudo code here:

case OwcContext => {
        val specReference = owcContext.specReference.map(o => changeRelForOwcLink(o, "profile")) // links.profiles[] and rel=profile
        val contextMetadata = owcContext.contextMetadata.map(o => changeRelForOwcLink(o, "via")) // aka links.via[] & rel=via
        owcContext.copy(specReference = specReference, contextMetadata = contextMetadata)
}
case OwcResource => {
        val contentDescription = owcResource.contentDescription.map(o => changeRelForOwcLink(o, "alternate")) // links.alternates[] and rel=alternate
        val preview = owcResource.preview.map(o => changeRelForOwcLink(o, "icon")) // aka links.previews[] and rel=icon (atom)
        val contentByRef = owcResource.contentByRef.map(o => changeRelForOwcLink(o, "enclosure")) // aka links.data[] and rel=enclosure (atom)
        val resourceMetadata = owcResource.resourceMetadata.map(o => changeRelForOwcLink(o, "via")) // aka links.via[] & rel=via
        owcResource.copy(contentDescription = contentDescription, preview = preview,
          contentByRef = contentByRef, resourceMetadata = resourceMetadata).asInstanceOf[OwcResource]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions