diff --git a/tests/data/definitions_ingv_1.yaml b/tests/data/definitions_ingv_1.yaml new file mode 100644 index 0000000..11ad02b --- /dev/null +++ b/tests/data/definitions_ingv_1.yaml @@ -0,0 +1,866 @@ +x-commons: + ratelimit-headers: &ratelimit-headers + X-RateLimit-Limit: + $ref: '#/components/headers/X-RateLimit-Limit' + X-RateLimit-Remaining: + $ref: '#/components/headers/X-RateLimit-Remaining' + X-RateLimit-Reset: + $ref: '#/components/headers/X-RateLimit-Reset' + common-responses: &common-responses + '400': + $ref: '#/components/responses/400BadRequest' + '422': + $ref: '#/components/responses/422UnprocessableEntity' + '429': + $ref: '#/components/responses/429TooManyRequests' + '503': + $ref: '#/components/responses/503ServiceUnavailable' + '500': + $ref: '#/components/responses/500InternalServerError' + default: + $ref: '#/components/responses/default' + +openapi: 3.0.3 +info: + termsOfService: http://terremoti.ingv.it/webservices_and_software + contact: + email: valentino.lauciani@ingv.it + name: INGV - Valentino Lauciani + url: http://terremoti.ingv.it/webservices_and_software + description: " + \ \n\n \ + \ # Introduction\n \ + \ Dante is an API Web Service used for iteract with earthquake data stored in database (**quakedb**); the **quakedb** database schema is used at INGV.\n \ + \ Use other schema would require cration of specific `Model` and `Controller` but this is the potential of web services. \ + \ \n\n \ + \ Dante provides a set of routes to store message **event**, **origin**, **magnitude**, **arrival**, **...**. + \ \n\n \ + \ # Input\n \ + \ As input, Dante acept:\n + \ - A `json` message (view '**store**' spec below) \n \ + \ - An Eartworm `json` message (view '**earthworm api**' spec below) produced by **ew2openapi** module \ + \ \n\n \ + \ # Output\n \ + \ As output, Dante has a RESTful api foreach database table and implement three specific routes: \n + \ - `events_pref`: returns the preferred origin and the preferred magnitude from all clusterd events. \n \ + \ - `events`: returns the preferred origin and the preferred magnitude from the same instance. \n \ + \ - `event`: returns the full event (event, origins, magnitudes, arrivals, amplitude, etc...) from an **eventid** or **originid**/**originid**. \n \ + \ \n\n \ + \ " + license: + name: Creative Commons Attribution 4.0 International + url: http://creativecommons.org/licenses/by/4.0/ + title: Dante Web Services + version: 2.25.0-dev + x-api-id: 24e1e2e6-43ad-4a84-bec7-5c6ddcf5db97 + x-logo: http://webservices.ingv.it/ingv_logo_text_two_lines.png + x-summary: Web Service to receive location from Earthworm or JSON standard + x-sandbox: true +tags: + - name: user + description: "Operations about user" + - name: get + description: "Get data" + - name: store + description: "Store data" + - name: update + description: "Update data" + - name: earthworm api + description: "Earthworm API to store data" +servers: +- url: http://caravel.int.ingv.it/api/quakedb + description: production + # 'x-sandbox' is needed to use 'http' instead of 'https' + x-sandbox: true +- url: http://{hostname}/api/quakedb + description: development + # 'x-sandbox' is needed to use 'http' instead of 'https' + x-sandbox: true + variables: + hostname: + enum: + - 'localhost:8087' + - 'caravel.int.ingv.it:8585' + default: 'localhost' + +paths: + /v1/event: + get: + description: This API returns the preferred origin and the preferred magnitude from all clusterd events. + summary: This API returns the preferred origin and the preferred magnitude from all clusterd events. + operationId: getEvent + parameters: + - $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/parameters/originid' + - $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/parameters/eventid' + - $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/parameters/level' + responses: + <<: *common-responses + '200': + $ref: '#/components/responses/200Event' + tags: + - get +components: + headers: + Cache-Control: + schema: + type: string + Retry-After: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/headers/Retry-After' + X-RateLimit-Limit: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/headers/X-RateLimit-Limit' + X-RateLimit-Reset: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/headers/X-RateLimit-Reset' + X-RateLimit-Remaining: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/headers/X-RateLimit-Remaining' + responses: + 204NoContent: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/responses/204NoContent' + 400BadRequest: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/responses/400BadRequest' + 401Unauthorized: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/responses/401Unauthorized' + 403Forbidden: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/responses/403Forbidden' + 404NotFound: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/responses/404NotFound' + 422UnprocessableEntity: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/responses/422UnprocessableEntity' + 429TooManyRequests: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/responses/429TooManyRequests' + 500InternalServerError: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/responses/500InternalServerError' + 503ServiceUnavailable: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/responses/503ServiceUnavailable' + default: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/responses/default' + 200Event: + description: Operation successful + headers: + <<: *ratelimit-headers + content: + application/json: + schema: + properties: + data: + properties: + event: + $ref: '#/components/schemas/ObjectEventGet' + 200EventsAndEventsPref: + description: Operation successful + headers: + <<: *ratelimit-headers + content: + application/json: + schema: + type: object + properties: + links: + $ref: '#/components/schemas/linksDefinition' + meta: + $ref: '#/components/schemas/metaDefinition' + data: + type: array + items: + $ref: '#/components/schemas/ObjectEventsAndEventsPref' + schemas: + ObjectProvenance: + type: object + required: + - softwarename + - version + properties: + name: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__name' + softwarename: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__softwarename' + version: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__version' + model: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__model' + method: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__method' + parameters: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__parameters' + program: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__program' + username: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__username' + hostname: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__hostname' + description: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/description' + ############################################################ + ObjectEventsAndEventsPref: + type: object + properties: + id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id' + id_localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id_localspace' + localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/localspace__name' + event_group_id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/event__fk_event_group' + preferred_origin_id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/event__fk_origin_preferred' + preferred_magnitude_id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/event__fk_magnitude_preferred' + preferred_focalmechanism_id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/event__fk_focalmechanism_preferred' + type_group: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/event__type_group' + type_event: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_event__name' + modified: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/modified' + inserted: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/inserted' + origin: + $ref: '#/components/schemas/ObjectOriginForEventsAndEventsPref' + magnitude: + $ref: '#/components/schemas/ObjectMagnitudeForEventsAndEventsPref' + provenance: + $ref: '#/components/schemas/ObjectProvenaceForEventsAndEventsPref' + ############################################################ + ObjectLocalspace: + type: object + required: + - name + properties: + name: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/localspace__name' + description: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/description' + ############################################################ + ObjectIdModifiedInserted: + properties: + id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id' + modified: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/modified' + inserted: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/inserted' + ############################################################ + ObjectScnl: + properties: + net: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/scnl__net' + sta: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/scnl__sta' + cha: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/scnl__cha' + loc: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/scnl__loc' + ############################################################ + ObjectTypeAmplitude: + properties: + name: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_amplitude__name' + unit: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_amplitude__unit' + ############################################################ + ObjectPickEw: + type: object + required: + - pamp1 + properties: + pamp1: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/pickew__pamp' + pamp2: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/pickew__pamp' + pamp3: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/pickew__pamp' + ############################################################ + ObjectEvent: + type: object + discriminator: + propertyName: ObjectEventGet + properties: + id_localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id_localspace' + type_event: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_event__name' + event_group_id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/event__fk_event_group' + preferred_origin_id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/event__fk_origin_preferred' + preferred_magnitude_id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/event__fk_magnitude_preferred' + preferred_focalmechanism_id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/event__fk_focalmechanism_preferred' + type_group: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/event__type_group' + ObjectEventGet: + allOf: + - $ref: '#/components/schemas/ObjectEvent' + - $ref: '#/components/schemas/ObjectIdModifiedInserted' + - type: object + properties: + provenance: + $ref: '#/components/schemas/ObjectProvenance' + localspace: + $ref: '#/components/schemas/ObjectLocalspace' + origins: + type: array + items: + $ref: '#/components/schemas/ObjectOriginGet' + strongmotions: + type: array + items: + $ref: '#/components/schemas/ObjectStrongmotionGet' + ############################################################ + ObjectOrigin: + type: object + discriminator: + propertyName: ObjectOriginGet + properties: + id_localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id_localspace' + azim_gap: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__azim_gap' + confidence_level: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/confidence_level' + depth: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/depth' + e0: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__e0' + e0_az: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__e0_az' + e0_dip: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__e0_dip' + e1: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__e1' + e1_az: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__e1_az' + e1_dip: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__e1_dip' + e2: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__e2' + e2_az: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__e2_az' + e2_dip: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__e2_dip' + err_depth: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__err_depth' + err_h: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__err_h' + err_lat: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__err_lat' + err_lon: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__err_lon' + err_ot: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__err_ot' + err_z: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__err_z' + fix_depth: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__fix_depth' + is_centroid: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__is_centroid' + lat: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/latitude' + lon: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/longitude' + max_distance: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__max_distance' + med_distance: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__med_distance' + min_distance: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__min_distance' + nph: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__nph' + nph_fm: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__nph_fm' + nph_s: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__nph_s' + nph_tot: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__nph_tot' + ot: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__ot' + quality: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__quality' + quality_numeric: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__quality_numeric' + region: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin_region_name__region' + rms: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__rms' + sec_azim_gap: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__sec_azim_gap' + w_rms: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__w_rms' + type_origin: + properties: + name: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_origin__name' + value: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_origin__value' + ObjectOriginGet: + allOf: + - $ref: '#/components/schemas/ObjectOrigin' + - $ref: '#/components/schemas/ObjectIdModifiedInserted' + - type: object + properties: + localspace: + $ref: '#/components/schemas/ObjectLocalspace' + provenance: + $ref: '#/components/schemas/ObjectProvenance' + magnitudes: + type: array + items: + $ref: '#/components/schemas/ObjectMagnitudeGet' + arrivals: + type: array + items: + $ref: '#/components/schemas/ObjectArrivalGet' + focalmechanisms: + type: array + items: + $ref: '#/components/schemas/ObjectFocalmechanismGet' + ############################################################ + ObjectMagnitude: + type: object + discriminator: + propertyName: ObjectMagnitudeGet + properties: + id_localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id_localspace' + mag: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__mag' + lower_uncertainty: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__lower_uncertainty' + upper_uncertainty: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__upper_uncertainty' + confidence_level: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/confidence_level' + quality: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__quality' + min_dist: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__min_dist' + azimut: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__azimut' + nsta: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__nsta' + ncha: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__ncha' + nsta_used: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__nsta_used' + ncha_used: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__ncha_used' + mag_quality: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__mag_quality' + type_magnitude: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_magnitude__name' + ObjectMagnitudeGet: + allOf: + - $ref: '#/components/schemas/ObjectMagnitude' + - $ref: '#/components/schemas/ObjectIdModifiedInserted' + - properties: + localspace: + $ref: '#/components/schemas/ObjectLocalspace' + provenance: + $ref: '#/components/schemas/ObjectProvenance' + stationmagnitudes: + type: array + items: + $ref: '#/components/schemas/ObjectStationmagnitudeGet' + type: object + ############################################################ + ObjectFocalmechanism: + properties: + id_localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id_localspace' + strike1: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__strike1' + dip1: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__dip1' + rake1: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__rake1' + strike2: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__strike2' + dip2: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__dip2' + rake2: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__rake2' + azim_gap: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__azim_gap' + nsta_polarity: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__nsta_polarity' + misfit: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__misfit' + stdr: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__stdr' + rms_ang_diff_acc_pref: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__rms_ang_diff_acc_pref' + frac_acc_30deg_pref: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__frac_acc_30deg_pref' + quality: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__quality' + url: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/focalmechanism__url' + ObjectFocalmechanismGet: + allOf: + - $ref: '#/components/schemas/ObjectIdModifiedInserted' + - $ref: '#/components/schemas/ObjectFocalmechanism' + - $ref: '#/components/schemas/ObjectMomenttensorGet' + - properties: + localspace: + $ref: '#/components/schemas/ObjectLocalspace' + provenance: + $ref: '#/components/schemas/ObjectProvenance' + ############################################################ + ObjectMomenttensor: + allOf: + - type: object + - properties: + id_localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id_localspace' + originid: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id' + magnitudeid: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id' + scalarmoment: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/momenttensor__scalarmoment' + mrr: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/momenttensor__mrr' + mtt: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/momenttensor__mtt' + mpp: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/momenttensor__mpp' + mrt: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/momenttensor__mrt' + mrp: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/momenttensor__mrp' + mtp: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/momenttensor__mtp' + clvd: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/momenttensor__clvd' + iso: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/momenttensor__iso' + variance_reduction: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/momenttensor__variance_reduction' + double_couple: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/momenttensor__double_couple' + type_momenttensor: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_momenttensor__name' + ObjectMomenttensorGet: + properties: + momenttensor: + allOf: + - $ref: '#/components/schemas/ObjectIdModifiedInserted' + - $ref: '#/components/schemas/ObjectMomenttensor' + - properties: + localspace: + $ref: '#/components/schemas/ObjectLocalspace' + provenance: + $ref: '#/components/schemas/ObjectProvenance' + ############################################################ + ObjectStrongmotion: + allOf: + - $ref: '#/components/schemas/ObjectScnl' + - properties: + id_localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id_localspace' + t_dt: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion__t_dt' + pga: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion__pga' + tpga_dt: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion__tpga_dt' + pgv: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion__pgv' + tpgv_dt: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion__tpgv_dt' + pgd: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion__pgd' + tpgd_dt: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion__tpgd_dt' + rsa_030: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion__rsa_030' + rsa_100: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion__rsa_100' + rsa_300: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion__rsa_300' + ObjectStrongmotionGet: + allOf: + - $ref: '#/components/schemas/ObjectIdModifiedInserted' + - $ref: '#/components/schemas/ObjectStrongmotion' + - $ref: '#/components/schemas/ObjectStrongmotionAltGet' + - $ref: '#/components/schemas/ObjectStrongmotionRsaGet' + - properties: + localspace: + $ref: '#/components/schemas/ObjectLocalspace' + provenance: + $ref: '#/components/schemas/ObjectProvenance' + ############################################################ + ObjectStrongmotionAlt: + properties: + time: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion_alt__t_alt_dt' + code: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion_alt__altcode' + ObjectStrongmotionAltGet: + properties: + alternative: + allOf: + - $ref: '#/components/schemas/ObjectStrongmotionAlt' + ############################################################ + ObjectStrongmotionRsa: + properties: + value: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion_rsa__value' + period: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/strongmotion_rsa__period' + ObjectStrongmotionRsaGet: + properties: + rsa: + items: + allOf: + - $ref: '#/components/schemas/ObjectStrongmotionRsa' + type: array + ############################################################ + ObjectStationmagnitude: + allOf: + - $ref: '#/components/schemas/ObjectScnl' + - properties: + id_localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id_localspace' + pick_id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id' + time1: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/amplitude__time1' + amp1: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/amplitude__amp1' + period: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/amplitude__period' + time2: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/amplitude__time2' + amp2: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/amplitude__amp2' + revised: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/amplitude__revised' + type_amplitude: + $ref: '#/components/schemas/ObjectTypeAmplitude' + ep_distance: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/ep_distance_km' + orig_distance: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/arrival-stationmagnitude-st_dur_mag__orig_distance' + azimut: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/arrival-stationmagnitude-st_dur_mag__azimut' + mag: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/stationmagnitude__mag' + err_mag: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/stationmagnitude-st_dur_mag__err_mag' + mag_correction: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/stationmagnitude__mag_correction' + is_used: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/stationmagnitude-st_dur_mag__polarity_is_used' + type_magnitude: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_magnitude__name' + ObjectStationmagnitudeGet: + allOf: + - $ref: '#/components/schemas/ObjectStationmagnitude' + - $ref: '#/components/schemas/ObjectIdModifiedInserted' + - properties: + localspace: + $ref: '#/components/schemas/ObjectLocalspace' + provenance: + $ref: '#/components/schemas/ObjectProvenance' + ############################################################ + ObjectArrival: + allOf: + - $ref: '#/components/schemas/ObjectScnl' + - properties: + id_localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id_localspace' + isc_code: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/arrival__isc_code' + quality_class: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/pick__pick_quality_class' + lower_uncertainty: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/pick__lower_uncertainty' + upper_uncertainty: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/pick__upper_uncertainty' + confidence_level: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/confidence_level' + arrival_time: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/pick__arrival_time' + firstmotion: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/pick__firstmotion' + emersio: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/pick__emersio' + ep_distance_km: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/ep_distance_km' + ep_distance_delta: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/ep_distance_delta' + orig_distance: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/arrival-stationmagnitude-st_dur_mag__orig_distance' + azimut: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/arrival-stationmagnitude-st_dur_mag__azimut' + take_off: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/arrival__take_off' + polarity_is_used: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/arrival__polarity_is_used' + arr_time_is_used: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/arrival__arr_time_is_used' + residual: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/arrival__residual' + weight: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/arrival__weight' + ObjectArrivalGet: + allOf: + - $ref: '#/components/schemas/ObjectArrival' + - $ref: '#/components/schemas/ObjectIdModifiedInserted' + - properties: + localspace: + $ref: '#/components/schemas/ObjectLocalspace' + provenance: + $ref: '#/components/schemas/ObjectProvenance' + pick_ew: + $ref: '#/components/schemas/ObjectPickEw' + + ############################################################ + ObjectOriginForEventsAndEventsPref: + type: object + properties: + id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id' + id_localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id_localspace' + localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/localspace__name' + ot: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__ot' + lat: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/latitude' + lon: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/longitude' + depth: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/depth' + err_ot: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__err_ot' + err_h: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__err_h' + err_z: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__err_z' + err_lat: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__err_lat' + err_lon: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__err_lon' + quality: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin__quality' + region: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/origin_region_name__region' + modified: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/modified' + inserted: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/inserted' + type_origin: + properties: + name: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_origin__name' + value: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_origin__value' + provenance: + $ref: '#/components/schemas/ObjectProvenaceForEventsAndEventsPref' + ############################################################ + ObjectProvenaceForEventsAndEventsPref: + type: object + properties: + name: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__name' + version: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__version' + softwarename: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/provenance__softwarename' + ObjectMagnitudeForEventsAndEventsPref: + type: object + properties: + id: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id' + id_localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id_localspace' + localspace: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/localspace__name' + mag: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__mag' + type_magnitude: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/type_magnitude__name' + lower_uncertainty: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__lower_uncertainty' + upper_uncertainty: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__upper_uncertainty' + quality: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__quality' + mag_quality: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/magnitude__mag_quality' + originid: + $ref: 'https://ingv.github.io/openapi/definitions.yaml#/components/schemas/id' + provenance: + $ref: '#/components/schemas/ObjectProvenaceForEventsAndEventsPref' + ############################################################ + metaDefinition: + type: object + properties: + current_page: + type: string + description: Current page. + example: '1' + from: + type: string + description: Showed record from. + example: '1' + last_page: + type: string + description: Last page. + example: '967' + links: + type: array + items: + properties: + url: + type: string + description: URL base path. + example: 'http://localhost:8087' + label: + type: string + description: Page label. + example: '5' + active: + type: string + example: 'false' + path: + type: string + description: URL base path. + example: 'http://localhost:8087' + per_page: + type: string + description: Record per page. + example: '4000' + to: + type: string + description: Showed record to. + example: '4000' + total: + type: string + description: Total records. + example: '50' + ############################################################ + linksDefinition: + type: object + properties: + first: + type: string + description: URL first page. + example: 'http://localhost:8087/api/quakedb/v1/events_pref/?page=2' + last: + type: string + description: URL last page. + example: 'http://localhost:8087/api/quakedb/v1/events_pref/?page=4' + prev: + type: string + description: URL previous page. + example: 'http://localhost:8087/api/quakedb/v1/events_pref/?page=1' + next: + type: string + description: URL next page. + example: 'http://localhost:8087/api/quakedb/v1/events_pref/?page=3' \ No newline at end of file diff --git a/tests/test_cases.py b/tests/test_cases.py index 09e6c7f..426430c 100644 --- a/tests/test_cases.py +++ b/tests/test_cases.py @@ -47,6 +47,19 @@ def test_yaml_reference(): assert "description" in ref assert "schema" in ref +def test_issue_27(): + fpath = Path("data/definitions_ingv_1.yaml") + oat = yaml_load_file(str(fpath)) + resolver = OpenapiResolver(oat, str(fpath.resolve())) + resolver.resolve() + yaml_ = resolver.dump_yaml() + components = defaultdict(dict, yaml_.pop("components")) + log.debug(yaml_dump(components)) + assert components["schemas"]["provenance__parameters"] + assert ( + components["schemas"]["ObjectProvenance"]["properties"]["parameters"]["$ref"] + == "#/components/schemas/provenance__parameters" + ) def test_resolve_subreference_fix7_1(): fpath = Path("data/subreference.yaml")