Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support splitting Hakunapi configurations to multiple files #47

Open
teezip opened this issue May 31, 2023 · 1 comment
Open

Support splitting Hakunapi configurations to multiple files #47

teezip opened this issue May 31, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@teezip
Copy link
Collaborator

teezip commented May 31, 2023

In some services Hakunapi feature configuration files are relatively large.

In this enhancements Hakunapi read a folder containing multipe configuration files and merges these when starting a server.

@teezip teezip added the enhancement New feature or request label May 31, 2023
@nls-jajuko
Copy link
Collaborator

YAML files have a concept to reference additional files with refs f.ex $ref: 'somecollection.yaml#/collections/somecollection'
One approach would be to support YAML configurations and transform those to hakunapi in-memory properties with Jackson
jackson-dataformat-yaml.
This might require some declarations as arrays in YAML for collections lists and properties as well as parameters lists.

# YAML configuration > transform (expansion) > properties > hakunapi configuration
# https://github.com/FasterXML/jackson-dataformats-text/tree/2.17/properties ?
# fex  yaml becomes properties
# api.title=INSPIRE Simple Addresses, Finland
# api.version=0.1
# api.desription=Example....
#
# General information about the api
# Not required, dummy values provided by the service
api:
  title: "INSPIRE Simple Addresses, Finland"
  version: 0.1
  description: >
   Example implementation of OGC API Services with hakunapi. 
   INSPIRE Simple Addresses from Finland. Data from 13.02.2023 
   https://www.avoindata.fi/data/fi/dataset/rakennusten-osoitetiedot-koko-suomi 
   by Finnish Digital and Population Data services Agency.
  license:
    name: "Data accessed from the API is licensed by the Digital and Population Data Services Agency CC BY 4.0 licence."
    url: "https://creativecommons.org/licenses/by/4.0/"

# List of servers 
## Required, comma-separated list of server the API is
servers:
  dev:
  ## The url of the server has to be correct as it is used for all links generated by the server
    url: "http://localhost:8080/features"
    description: "Development server"

# API level configuration
formats:
  geojson:
    # force lon,lat axisOrder on GeoJSON output even if output CRS is lat,lon by authority
    # formats.geojson.forceLonLat=true
    type: json
  html:
    type: html
  gpkg:
    type: gpkg
    dir: "/app/features_addresses/tmp"

getfeatures:
 limit: 
   default: 10
   max: 10000

# Configure known srids (hakunapi will always add 84 (lon, lat) and 4326 (lat, lon))
srid:
 - 3067:
 - 4258:
     latLon: true
   # Let hakunapi know that EPSG:4258 is lat,lon order

# Collections and their configurations

## Required, comma-separated list of all collections
collections:
  somecollection: 
    # ? something like this
    $ref: 'somecollection.yaml#/collections/somecollection'
  addresses:
    title: "Simple Addresses"
    description: "Addresses of Finlands Buildings"
    ## Should properties with null values be omitted from the response
    writeNulls: true
    ## PostgreSQL/PostGIS configuration 
    ### This collection is backed by 'pg' (PostgreSQL/PostGIS) source/driver 
    type: pg
    ### Name of {db}.properties
    db: db
    schema: "public"
    table: "simple_addresses"

    extent:
      ### Spatial extent of the collection, required by some clients to recognize the colletion as a spatial feature collection
      spatial:
        crs84: [15.0537852,58.6074565,33.9935374,70.2641566]
     ### Supported Coordinate Reference Systems (CRS:84 is always and automatically included)
    srid: [3067,4258]
    ### Required, mapping for primary id property
    id:
      mapping: id
    ### Mapping for primary geometry property
    geometry:
      mapping: geom
    ### List of all (other) properties 
    #properties: inspireId_localId,inspireId_namespace,component_ThoroughfareName,component_PostalDescriptor,component_AdminUnitName_1,component_AdminUnitName_4,locator_designator_addressNumber,locator_level,locator_level_href,position_specification,position_specification_href,position_method,position_method_href,position_default,building,parcel

    ### property is mapped to a static value instead of column reference if mapping is single-quoted
    properties:
      inspireId_localId: 
        mapping: id
      inspireId_namespace:
        mapping: 'https://github.com/INSPIRE-MIF/2017.2/GeoJSON/ads/examples/'
      component_ThoroughfareName:
        mapping: thoroughfare_name
      component_PostalDescriptor:
        mapping: postal_descriptor
      component_AdminUnitName_1:
        mapping: 'Suomi'
      component_AdminUnitName_4:
        mapping: admin_unit_name_4
      locator_designator_addressNumber:
        mapping: address_number
      locator_level:
        mapping: 'siteLevel'
      locator_level_href:
        mapping: 'https://inspire.ec.europa.eu/codelist/LocatorLevelValue/siteLevel'
      position_specification:
        mapping: 'building'
      position_specification_href: 
        mapping: 'https://inspire.ec.europa.eu/codelist/GeometrySpecificationValue/building'
      position_method: 
        mapping: 'byOtherParty'
      position_method_href:
        mapping: 'https://inspire.ec.europa.eu/codelist/GeometryMethodValue/byOtherParty'
      position_default:  
        mapping: 'true'
      ### If the name of the property matches the name of the backing column no mapping is required
      building:
      parcel:
      
## Queryables
    parameters:
       inspireId_localId:
       component_ThoroughfareName:
       component_PostalDescriptor:
       component_AdminUnitName_4:
       locator_designator_addressNumber:
       building:
       parcel:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants