cog icon indicating copy to clipboard operation
cog copied to clipboard

Add ordering to output objects

Open bfirsh opened this issue 3 years ago • 5 comments

Inputs are ordered, but outputs are not.

bfirsh avatar May 24 '22 18:05 bfirsh

https://github.com/zeke/cog-haiku/pull/12

zeke avatar May 25 '22 21:05 zeke

The order is still intact in Cog's OpenAPI schema:

Screen Shot 2022-05-27 at 3 18 40 PM

But not in the schema (nor the prediction object) in replicate-web, which looks to be alphabetical:

Screen Shot 2022-05-27 at 3 14 50 PM

zeke avatar May 27 '22 22:05 zeke

In replicate-web, the order of the outputs in the properties is reversed:

postgres=# select openapi_schema->'components'->'schemas'->'Output'->'properties' from models_version where docker_image_id='9d45ce800c36226fa0190021cc70ce6bbb64dce6ff71c70eb2acf11c45fd2635';
                                                                          ?column?                                                                           
-------------------------------------------------------------------------------------------------------------------------------------------------------------
 {"seed": {"type": "integer", "title": "Seed"}, "text": {"type": "string", "title": "Text"}, "image": {"type": "string", "title": "Image", "format": "uri"}}
(1 row)

I think we need to solve this by adding x-order properties to each output object, like we do for Input in Cog.

zeke avatar May 27 '22 22:05 zeke

Related: https://github.com/go-openapi/spec/issues/24

zeke avatar May 27 '22 22:05 zeke

@chenxwh ran into this again today.

zeke avatar Aug 17 '22 16:08 zeke