11use crate :: { Backend , Error , Result , DEFAULT_DESCRIPTION , DEFAULT_ID } ;
22use http:: Method ;
33use serde:: Serialize ;
4- use serde_json:: { Map , Value } ;
4+ use serde_json:: { json , Map , Value } ;
55use stac:: { mime:: APPLICATION_OPENAPI_3_0 , Catalog , Collection , Fields , Item , Link , Links } ;
66use stac_api:: { Collections , Conformance , ItemCollection , Items , Root , Search } ;
77use url:: Url ;
@@ -115,6 +115,15 @@ impl<B: Backend> Api<B> {
115115 catalog
116116 . links
117117 . push ( Link :: new ( search_url, "search" ) . geojson ( ) . method ( "POST" ) ) ;
118+ if self . backend . has_filter ( ) {
119+ catalog. links . push (
120+ Link :: new (
121+ self . url ( "/queryables" ) ?,
122+ "http://www.opengis.net/def/rel/ogc/1.0/queryables" ,
123+ )
124+ . r#type ( "application/schema+json" . to_string ( ) ) ,
125+ ) ;
126+ }
118127 Ok ( Root {
119128 catalog,
120129 conformance : self . conformance ( ) ,
@@ -136,9 +145,27 @@ impl<B: Backend> Api<B> {
136145 if self . backend . has_item_search ( ) {
137146 conformance = conformance. item_search ( ) ;
138147 }
148+ if self . backend . has_filter ( ) {
149+ conformance = conformance. filter ( ) ;
150+ }
139151 conformance
140152 }
141153
154+ /// Returns queryables.
155+ pub fn queryables ( & self ) -> Value {
156+ // This is a pure punt from https://github.com/stac-api-extensions/filter?tab=readme-ov-file#queryables
157+ json ! ( {
158+ "$schema" : "https://json-schema.org/draft/2019-09/schema" ,
159+ "$id" : "https://stac-api.example.com/queryables" ,
160+ "type" : "object" ,
161+ "title" : "Queryables for Example STAC API" ,
162+ "description" : "Queryable names for the example STAC API Item Search filter." ,
163+ "properties" : {
164+ } ,
165+ "additionalProperties" : true
166+ } )
167+ }
168+
142169 /// Returns the collections from the backend.
143170 ///
144171 /// # Examples
0 commit comments