@@ -142,7 +142,6 @@ def describe_processes(api: API, request: APIRequest,
142142
143143 p2 ['links' ] = p2 .get ('links' , [])
144144
145- jobs_url = f"{ api .base_url } /jobs"
146145 process_url = f"{ api .base_url } /processes/{ key } "
147146
148147 # TODO translation support
@@ -164,23 +163,22 @@ def describe_processes(api: API, request: APIRequest,
164163 }
165164 p2 ['links' ].append (link )
166165
167- link = {
168- 'type' : FORMAT_TYPES [F_HTML ],
169- 'rel' : 'http://www.opengis.net/def/rel/ogc/1.0/job-list' ,
170- 'href' : f'{ jobs_url } ?f={ F_HTML } ' ,
171- 'title' : l10n .translate ('Jobs list as HTML' , request .locale ), # noqa
172- 'hreflang' : api .default_locale
173- }
174- p2 ['links' ].append (link )
175-
176- link = {
177- 'type' : FORMAT_TYPES [F_JSON ],
178- 'rel' : 'http://www.opengis.net/def/rel/ogc/1.0/job-list' ,
179- 'href' : f'{ jobs_url } ?f={ F_JSON } ' ,
180- 'title' : l10n .translate ('Jobs list as JSON' , request .locale ), # noqa
181- 'hreflang' : api .default_locale
182- }
183- p2 ['links' ].append (link )
166+ if api .manager .is_async :
167+ jobs_url = f"{ api .base_url } /jobs"
168+ p2 ['links' ].append ({
169+ 'type' : FORMAT_TYPES [F_HTML ],
170+ 'rel' : 'http://www.opengis.net/def/rel/ogc/1.0/job-list' ,
171+ 'href' : f'{ jobs_url } ?f={ F_HTML } ' ,
172+ 'title' : l10n .translate ('Jobs list as HTML' , request .locale ), # noqa
173+ 'hreflang' : api .default_locale
174+ })
175+ p2 ['links' ].append ({
176+ 'type' : FORMAT_TYPES [F_JSON ],
177+ 'rel' : 'http://www.opengis.net/def/rel/ogc/1.0/job-list' ,
178+ 'href' : f'{ jobs_url } ?f={ F_JSON } ' ,
179+ 'title' : l10n .translate ('Jobs list as JSON' , request .locale ), # noqa
180+ 'hreflang' : api .default_locale
181+ })
184182
185183 link = {
186184 'type' : FORMAT_TYPES [F_JSON ],
@@ -825,68 +823,73 @@ def get_oas_30(cfg: dict, locale: str
825823 }
826824 }
827825
828- paths ['/jobs' ] = {
829- 'get' : {
830- 'summary' : 'Retrieve jobs list' ,
831- 'description' : 'Retrieve a list of jobs' ,
832- 'tags' : ['jobs' ],
833- 'operationId' : 'getJobs' ,
834- 'responses' : {
835- '200' : {'$ref' : '#/components/responses/200' },
836- '404' : {'$ref' : f"{ OPENAPI_YAML ['oapip' ]} /responses/NotFound.yaml" }, # noqa
837- 'default' : {'$ref' : '#/components/responses/default' }
826+ tag_objects = [{'name' : 'processes' }]
827+
828+ if process_manager .is_async :
829+ paths ['/jobs' ] = {
830+ 'get' : {
831+ 'summary' : 'Retrieve jobs list' ,
832+ 'description' : 'Retrieve a list of jobs' ,
833+ 'tags' : ['jobs' ],
834+ 'operationId' : 'getJobs' ,
835+ 'responses' : {
836+ '200' : {'$ref' : '#/components/responses/200' },
837+ '404' : {'$ref' : f"{ OPENAPI_YAML ['oapip' ]} /responses/NotFound.yaml" }, # noqa
838+ 'default' : {'$ref' : '#/components/responses/default' }
839+ }
838840 }
839841 }
840- }
841842
842- paths ['/jobs/{jobId}' ] = {
843- 'get' : {
844- 'summary' : 'Retrieve job details' ,
845- 'description' : 'Retrieve job details' ,
846- 'tags' : ['jobs' ],
847- 'parameters' : [
848- name_in_path ,
849- {'$ref' : '#/components/parameters/f' }
850- ],
851- 'operationId' : 'getJob' ,
852- 'responses' : {
853- '200' : {'$ref' : '#/components/responses/200' },
854- '404' : {'$ref' : f"{ OPENAPI_YAML ['oapip' ]} /responses/NotFound.yaml" }, # noqa
855- 'default' : {'$ref' : '#/components/responses/default' }
856- }
857- },
858- 'delete' : {
859- 'summary' : 'Cancel / delete job' ,
860- 'description' : 'Cancel / delete job' ,
861- 'tags' : ['jobs' ],
862- 'parameters' : [
863- name_in_path
864- ],
865- 'operationId' : 'deleteJob' ,
866- 'responses' : {
867- '204' : {'$ref' : '#/components/responses/204' },
868- '404' : {'$ref' : f"{ OPENAPI_YAML ['oapip' ]} /responses/NotFound.yaml" }, # noqa
869- 'default' : {'$ref' : '#/components/responses/default' }
870- }
871- },
872- }
843+ paths ['/jobs/{jobId}' ] = {
844+ 'get' : {
845+ 'summary' : 'Retrieve job details' ,
846+ 'description' : 'Retrieve job details' ,
847+ 'tags' : ['jobs' ],
848+ 'parameters' : [
849+ name_in_path ,
850+ {'$ref' : '#/components/parameters/f' }
851+ ],
852+ 'operationId' : 'getJob' ,
853+ 'responses' : {
854+ '200' : {'$ref' : '#/components/responses/200' },
855+ '404' : {'$ref' : f"{ OPENAPI_YAML ['oapip' ]} /responses/NotFound.yaml" }, # noqa
856+ 'default' : {'$ref' : '#/components/responses/default' }
857+ }
858+ },
859+ 'delete' : {
860+ 'summary' : 'Cancel / delete job' ,
861+ 'description' : 'Cancel / delete job' ,
862+ 'tags' : ['jobs' ],
863+ 'parameters' : [
864+ name_in_path
865+ ],
866+ 'operationId' : 'deleteJob' ,
867+ 'responses' : {
868+ '204' : {'$ref' : '#/components/responses/204' },
869+ '404' : {'$ref' : f"{ OPENAPI_YAML ['oapip' ]} /responses/NotFound.yaml" }, # noqa
870+ 'default' : {'$ref' : '#/components/responses/default' }
871+ }
872+ },
873+ }
873874
874- paths ['/jobs/{jobId}/results' ] = {
875- 'get' : {
876- 'summary' : 'Retrieve job results' ,
877- 'description' : 'Retrieve job results' ,
878- 'tags' : ['jobs' ],
879- 'parameters' : [
880- name_in_path ,
881- {'$ref' : '#/components/parameters/f' }
882- ],
883- 'operationId' : 'getJobResults' ,
884- 'responses' : {
885- '200' : {'$ref' : '#/components/responses/200' },
886- '404' : {'$ref' : f"{ OPENAPI_YAML ['oapip' ]} /responses/NotFound.yaml" }, # noqa
887- 'default' : {'$ref' : '#/components/responses/default' }
875+ paths ['/jobs/{jobId}/results' ] = {
876+ 'get' : {
877+ 'summary' : 'Retrieve job results' ,
878+ 'description' : 'Retrieve job results' ,
879+ 'tags' : ['jobs' ],
880+ 'parameters' : [
881+ name_in_path ,
882+ {'$ref' : '#/components/parameters/f' }
883+ ],
884+ 'operationId' : 'getJobResults' ,
885+ 'responses' : {
886+ '200' : {'$ref' : '#/components/responses/200' },
887+ '404' : {'$ref' : f"{ OPENAPI_YAML ['oapip' ]} /responses/NotFound.yaml" }, # noqa
888+ 'default' : {'$ref' : '#/components/responses/default' }
889+ }
888890 }
889891 }
890- }
891892
892- return [{'name' : 'processes' }, {'name' : 'jobs' }], {'paths' : paths }
893+ tag_objects .append ({'name' : 'jobs' })
894+
895+ return tag_objects , {'paths' : paths }
0 commit comments