From bc1ea618ab8557db6cbb1506c84b8606864b74ce Mon Sep 17 00:00:00 2001 From: Patrick Leary Date: Mon, 26 Feb 2024 11:12:07 -0500 Subject: [PATCH] v2 returns hidden flag and moderator_actions with photos and sounds; spec fix --- openapi/schema/response/photo.js | 3 +++ openapi/schema/response/sound.js | 3 +++ test/integration/v2/observations.js | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/openapi/schema/response/photo.js b/openapi/schema/response/photo.js index 7bc76b86..660dba14 100644 --- a/openapi/schema/response/photo.js +++ b/openapi/schema/response/photo.js @@ -1,5 +1,6 @@ const Joi = require( "joi" ); const flag = require( "./flag" ); +const moderatorAction = require( "./moderator_action" ); module.exports = Joi.object( ).keys( { id: Joi.number( ).integer( ) @@ -7,9 +8,11 @@ module.exports = Joi.object( ).keys( { .required( ), attribution: Joi.string( ), flags: Joi.array( ).items( flag ), + hidden: Joi.boolean( ), large_url: Joi.string( ).valid( null ), license_code: Joi.string( ).valid( null ), medium_url: Joi.string( ).valid( null ), + moderator_actions: Joi.array( ).items( moderatorAction ), native_page_url: Joi.string( ).valid( null ), native_photo_id: Joi.string( ).valid( null ), original_dimensions: Joi.object( ).keys( { diff --git a/openapi/schema/response/sound.js b/openapi/schema/response/sound.js index 1889eccd..07a454cd 100644 --- a/openapi/schema/response/sound.js +++ b/openapi/schema/response/sound.js @@ -1,13 +1,16 @@ const Joi = require( "joi" ); const flag = require( "./flag" ); +const moderatorAction = require( "./moderator_action" ); module.exports = Joi.object( ).keys( { attribution: Joi.string( ), file_content_type: Joi.string( ), file_url: Joi.string( ), flags: Joi.array( ).items( flag ), + hidden: Joi.boolean( ), id: Joi.number( ).integer( ).description( "Unique auto-increment integer identifier." ).required( ), license_code: Joi.string( ).valid( null ), + moderator_actions: Joi.array( ).items( moderatorAction ), native_sound_id: Joi.string( ).valid( null ) } ).unknown( false ).meta( { className: "Sound" } ) .valid( null ); diff --git a/test/integration/v2/observations.js b/test/integration/v2/observations.js index 0dc036e4..757b8480 100644 --- a/test/integration/v2/observations.js +++ b/test/integration/v2/observations.js @@ -505,7 +505,7 @@ describe( "Observations", ( ) => { it( "should include a relevant listed taxon", function ( done ) { const o = fixtures.elasticsearch.observations.observation[0]; const railsResponse = { - conservation_status: {}, + conservation_status: null, listed_taxon: { id: 1, establishment_means_label: "introduced"