diff --git a/Pipfile.lock b/Pipfile.lock index ffa50da8..2c301437 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -49,10 +49,10 @@ }, "babel": { "hashes": [ - "sha256:af92e6106cb7c55286b25b38ad7695f8b4efb36a90ba483d7f7a6628c46158ab", - "sha256:e86135ae101e31e2c8ec20a4e0c5220f4eed12487d5cf3f78be7e98d3a57fc28" + "sha256:1aac2ae2d0d8ea368fa90906567f5c08463d98ade155c0c4bfedd6a0f7160e38", + "sha256:d670ea0b10f8b723672d3a6abeb87b565b244da220d76b4dba1b66269ec152d4" ], - "version": "==2.7.0" + "version": "==2.8.0" }, "backoff": { "hashes": [ @@ -122,39 +122,39 @@ }, "coverage": { "hashes": [ - "sha256:018e74df50a58fd2aaa7efeb301d1599d8fd3cc5c92388506e45a2bd0154c003", - "sha256:0e08415f35cc57b6eb93fb31ec48a2a169ab838e12ac22106cf9baee4938e46d", - "sha256:1f9c1d9692339a7ec5cf3ba4475fb648675f438db3413b3d98e2c9ed30ac956c", - "sha256:2643ec874d3aa30a65a36e42042424ce08f80a948e1c942d3d787489ae318a64", - "sha256:28a19392a6c4616a76e059a03118c8cca28af46d9e72032590ce329e6b30ac40", - "sha256:32c6be8ba90aa885a4900a0187de44f51730c0660c45de3b943c40f1547d47c2", - "sha256:4a8b839c3a5579502ffecd4519533d406ad2bec1488724cee4b2c79dd6cbea79", - "sha256:5061a8c4bba83b7613077d6cfa8e81381c80f134dc7f02853c3235b38f76b8a6", - "sha256:54770fe39bb4718b5a07665e1f4c676382d6927299ab736149618f0d37d72e85", - "sha256:5a237fa332721721545e88fbed42e79acbe9c77be8310c167ec5449df44dac7c", - "sha256:607ed848b1373b161629d0c8228d90dd47ecb342f1f800dc41ebd0bce2432e24", - "sha256:65929e8d15999450d09117114ee185948bc77637e868daff5f5ab47219e1e7b6", - "sha256:67a0f5c50503a6226e28fb7ee3c3aa1a104681460d5123eeb80e6afb65ba46a5", - "sha256:6a70362452ea9c09efe1a7faa365f6603f4a0ef54306a6e5a46e6e32913536fc", - "sha256:6cf4502b0087f06906059a718e02b231a9f611ae34794a955baa2e443d5064ad", - "sha256:73f596fcd93d76579b4aefa53b7cf5df90d953a8fd94ebfc9b36d0ba47db4236", - "sha256:77c90b0a221e6355c771f1b9a6ed45c384f9dff00836823a732f5fe4224cb43a", - "sha256:8524e47b78fc7eea96a25717e779c5e6657536515dd57dfd1110aff34dc747b6", - "sha256:85b8db2e8c7e9bdf44e4b5859be2cbeaf73e54cf7cecd6c6705f010110581840", - "sha256:90389fea98570dc1f155ceae40972fcf798954467c69d810e385b170c34205cd", - "sha256:9e48182563c7861c47593a4b931a6d57e4e499027913e5fdc61efc0d368e804a", - "sha256:a5a5f3a9167a5316d675932e455925e136b1e33d15ce48692b94af746736260e", - "sha256:a7f3be4952f25a0cb8c275cdf064c3ba1765e370f337b015e84a00bb6244c86b", - "sha256:b2de4918d6d4aea7fe2b6ef778190f60ff4355248045d7b1fbb35922e0ceb39e", - "sha256:b72f1b6f27cf67b74370cc9df6b7f47546669861aad660587a7c6f2a01728840", - "sha256:b9b8189f6f8c4a2a09142d95a11f91dff2cac30c9c0b5ab61e3e0a785e960b94", - "sha256:bd31b194b42e0de4c29fd2c56ad0c493639bcb792c48b694b18568f65f0c2c6d", - "sha256:be732dcc0e9ca31a15ab5ba116ed7af9b5a046d035a00555ad593f4ddfeb7a00", - "sha256:bf4131b04dc2bf35e091b2c759d9e741876a235427c001c6d20147cf29797691", - "sha256:d3021b26f86118c447afccbd53b443dc25b4848f9ae49ffb4b9588cb5110d360", - "sha256:d500eb1db73cd5cfe28755c790fcb4e3c653b70d30d0ddf79fde3cc603d3789f" - ], - "version": "==5.0b2" + "sha256:189aac76d6e0d7af15572c51892e7326ee451c076c5a50a9d266406cd6c49708", + "sha256:1bf7ba2af1d373a1750888724f84cffdfc697738f29a353c98195f98fc011509", + "sha256:1f4ee8e2e4243971618bc16fcc4478317405205f135e95226c2496e2a3b8dbbf", + "sha256:225e79a5d485bc1642cb7ba02281419c633c216cdc6b26c26494ba959f09e69f", + "sha256:23688ff75adfa8bfa2a67254d889f9bdf9302c27241d746e17547c42c732d3f4", + "sha256:28f7f73b34a05e23758e860a89a7f649b85c6749e252eff60ebb05532d180e86", + "sha256:2d0cb9b1fe6ad0d915d45ad3d87f03a38e979093a98597e755930db1f897afae", + "sha256:47874b4711c5aeb295c31b228a758ce3d096be83dc37bd56da48ed99efb8813b", + "sha256:511ec0c00840e12fb4e852e4db58fa6a01ca4da72f36a9766fae344c3d502033", + "sha256:53e7438fef0c97bc248f88ba1edd10268cd94d5609970aaf87abbe493691af87", + "sha256:569f9ee3025682afda6e9b0f5bb14897c0db03f1a1dc088b083dd36e743f92bb", + "sha256:593853aa1ac6dcc6405324d877544c596c9d948ef20d2e9512a0f5d2d3202356", + "sha256:5b0a07158360d22492f9abd02a0f2ee7981b33f0646bf796598b7673f6bbab14", + "sha256:7ca3db38a61f3655a2613ee2c190d63639215a7a736d3c64cc7bbdb002ce6310", + "sha256:7d1cc7acc9ce55179616cf72154f9e648136ea55987edf84addbcd9886ffeba2", + "sha256:88b51153657612aea68fa684a5b88037597925260392b7bb4509d4f9b0bdd889", + "sha256:955ec084f549128fa2702f0b2dc696392001d986b71acd8fd47424f28289a9c3", + "sha256:b251c7092cbb6d789d62dc9c9e7c4fb448c9138b51285c36aeb72462cad3600e", + "sha256:bd82b684bb498c60ef47bb1541a50e6d006dde8579934dcbdbc61d67d1ea70d9", + "sha256:bfe102659e2ec13b86c7f3b1db6c9a4e7beea4255058d006351339e6b342d5d2", + "sha256:c1e4e39e43057396a5e9d069bfbb6ffeee892e40c5d2effbd8cd71f34ee66c4d", + "sha256:cb2b74c123f65e8166f7e1265829a6c8ed755c3cd16d7f50e75a83456a5f3fd7", + "sha256:cca38ded59105f7705ef6ffe1e960b8db6c7d8279c1e71654a4775ab4454ca15", + "sha256:cf908840896f7aa62d0ec693beb53264b154f972eb8226fb864ac38975590c4f", + "sha256:d095a7b473f8a95f7efe821f92058c8a2ecfb18f8db6677ae3819e15dc11aaae", + "sha256:d22b4297e7e4225ccf01f1aa55e7a96412ea0796b532dd614c3fcbafa341128e", + "sha256:d4a2b578a7a70e0c71f662705262f87a456f1e6c1e40ada7ea699abaf070a76d", + "sha256:ddeb42a3d5419434742bf4cc71c9eaa22df3b76808e23a82bd0b0bd360f1a9f1", + "sha256:e65a5aa1670db6263f19fdc03daee1d7dbbadb5cb67fd0a1f16033659db13c1d", + "sha256:eaad65bd20955131bcdb3967a4dea66b4e4d4ca488efed7c00d91ee0173387e8", + "sha256:f45fba420b94165c17896861bb0e8b27fb7abdcedfeb154895d8553df90b7b00" + ], + "version": "==5.0.2" }, "cryptography": { "hashes": [ @@ -184,18 +184,18 @@ }, "dataclasses-json": { "hashes": [ - "sha256:616876ac06ca3a8f2ae977a4e044850e81dbd3f86a404430b783e12f017b75b5", - "sha256:ebdf7407681763d6125fd00d15ed037cc3aa6f9129fe7634e8f891410e89559f" + "sha256:8e7b68ee574bd67e305cbe06acac74137e978529fd1ea85184baedbf47ff0d49", + "sha256:a11bda62235094cc8385357a125be28233a20d4296274c44bb766b2f9f1e5d98" ], - "version": "==0.3.6" + "version": "==0.3.7" }, "docutils": { "hashes": [ - "sha256:7a6228589435302e421f5c473ce0180878b90f70227f7174cacde5efbd34275f", - "sha256:f1bad547016f945f7b35b28d8bead307821822ca3f8d4f87a1bd2ad1a8faab51" + "sha256:6dd0078bcfecbef00123531c6b0ca38460b291334ef8dd05c00e060e90ead6ce", + "sha256:d33b326920f238f2149951e0f2ca0513ea660217b07fe63cb8c5e74e78b3114f" ], "index": "pypi", - "version": "==0.16b0.dev0" + "version": "==0.16rc1" }, "entrypoints": { "hashes": [ @@ -228,18 +228,18 @@ }, "imagesize": { "hashes": [ - "sha256:3f349de3eb99145973fefb7dbe38554414e5c30abd0c8e4b970a7c9d09f3a1d8", - "sha256:f3832918bc3c66617f92e35f5d70729187676313caa60c187eb0f28b8fe5e3b5" + "sha256:6965f19a6a2039c7d48bca7dba2473069ff854c36ae6f19d2cde309d998228a1", + "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1" ], - "version": "==1.1.0" + "version": "==1.2.0" }, "importlib-metadata": { "hashes": [ - "sha256:3a8b2dfd0a2c6a3636e7c016a7e54ae04b997d30e69d5eacdca7a6c2221a1402", - "sha256:41e688146d000891f32b1669e8573c57e39e5060e7f5f647aa617cd9a9568278" + "sha256:073a852570f92da5f744a3472af1b61e28e9f78ccf0c9117658dc32b15de7b45", + "sha256:d95141fbfa7ef2ec65cfd945e2af7e5a6ddbd7c8d9a25e66ff3be8e3daf9f60f" ], "markers": "python_version < '3.8'", - "version": "==1.2.0" + "version": "==1.3.0" }, "isort": { "hashes": [ @@ -251,10 +251,10 @@ }, "jeepney": { "hashes": [ - "sha256:13806f91a96e9b2623fd2a81b950d763ee471454aafd9eb6d75dbe7afce428fb", - "sha256:f6a3f93464a0cf052f4e87da3c8b3ed1e27696758fb9739c63d3a74d9a1b6774" + "sha256:0ba6d8c597e9bef1ebd18aaec595f942a264e25c1a48f164d46120eacaa2e9bb", + "sha256:6f45dce1125cf6c58a1c88123d3831f36a789f9204fbad3172eac15f8ccd08d0" ], - "version": "==0.4.1" + "version": "==0.4.2" }, "jinja2": { "hashes": [ @@ -265,10 +265,10 @@ }, "keyring": { "hashes": [ - "sha256:a3f71fc0cf6b74e201e70532879ba1d15db25cb2c7407dce52fe52a6d5fc7b66", - "sha256:fc9cadedae35b77141f670f84c10a657147d2e526348698c93dd77f039979729" + "sha256:5f5f92327b6c7432bebc18a1b60cb3797d99b08db1f5b919b8187c37a01f1ccc", + "sha256:ad84f7fe26ab51731f089eaf1c44ebf4c5fae323653c908888a3a6212ad0bbe7" ], - "version": "==20.0.0" + "version": "==21.0.0" }, "lazy-object-proxy": { "hashes": [ @@ -359,23 +359,23 @@ }, "mypy": { "hashes": [ - "sha256:02d9bdd3398b636723ecb6c5cfe9773025a9ab7f34612c1cde5c7f2292e2d768", - "sha256:088f758a50af31cf8b42688118077292370c90c89232c783ba7979f39ea16646", - "sha256:28e9fbc96d13397a7ddb7fad7b14f373f91b5cff538e0772e77c270468df083c", - "sha256:30e123b24931f02c5d99307406658ac8f9cd6746f0d45a3dcac2fe5fbdd60939", - "sha256:3294821b5840d51a3cd7a2bb63b40fc3f901f6a3cfb3c6046570749c4c7ef279", - "sha256:41696a7d912ce16fdc7c141d87e8db5144d4be664a0c699a2b417d393994b0c2", - "sha256:4f42675fa278f3913340bb8c3371d191319704437758d7c4a8440346c293ecb2", - "sha256:54d205ccce6ed930a8a2ccf48404896d456e8b87812e491cb907a355b1a9c640", - "sha256:6992133c95a2847d309b4b0c899d7054adc60481df6f6b52bb7dee3d5fd157f7", - "sha256:6ecbd0e8e371333027abca0922b0c2c632a5b4739a0c61ffbd0733391e39144c", - "sha256:83fa87f556e60782c0fc3df1b37b7b4a840314ba1ac27f3e1a1e10cb37c89c17", - "sha256:c87ac7233c629f305602f563db07f5221950fe34fe30af072ac838fa85395f78", - "sha256:de9ec8dba773b78c49e7bec9a35c9b6fc5235682ad1fc2105752ae7c22f4b931", - "sha256:f385a0accf353ca1bca4bbf473b9d83ed18d923fdb809d3a70a385da23e25b6a" + "sha256:0a9a45157e532da06fe56adcfef8a74629566b607fa2c1ac0122d1ff995c748a", + "sha256:2c35cae79ceb20d47facfad51f952df16c2ae9f45db6cb38405a3da1cf8fc0a7", + "sha256:4b9365ade157794cef9685791032521233729cb00ce76b0ddc78749abea463d2", + "sha256:53ea810ae3f83f9c9b452582261ea859828a9ed666f2e1ca840300b69322c474", + "sha256:634aef60b4ff0f650d3e59d4374626ca6153fcaff96ec075b215b568e6ee3cb0", + "sha256:7e396ce53cacd5596ff6d191b47ab0ea18f8e0ec04e15d69728d530e86d4c217", + "sha256:7eadc91af8270455e0d73565b8964da1642fe226665dd5c9560067cd64d56749", + "sha256:7f672d02fffcbace4db2b05369142e0506cdcde20cea0e07c7c2171c4fd11dd6", + "sha256:85baab8d74ec601e86134afe2bcccd87820f79d2f8d5798c889507d1088287bf", + "sha256:87c556fb85d709dacd4b4cb6167eecc5bbb4f0a9864b69136a0d4640fdc76a36", + "sha256:a6bd44efee4dc8c3324c13785a9dc3519b3ee3a92cada42d2b57762b7053b49b", + "sha256:c6d27bd20c3ba60d5b02f20bd28e20091d6286a699174dfad515636cb09b5a72", + "sha256:e2bb577d10d09a2d8822a042a23b8d62bc3b269667c9eb8e60a6edfa000211b1", + "sha256:f97a605d7c8bc2c6d1172c2f0d5a65b24142e11a58de689046e62c2d632ca8c1" ], "index": "pypi", - "version": "==0.750" + "version": "==0.761" }, "mypy-extensions": { "hashes": [ @@ -386,10 +386,10 @@ }, "packaging": { "hashes": [ - "sha256:28b924174df7a2fa32c1953825ff29c61e2f5e082343165438812f00d3a7fc47", - "sha256:d9551545c6d761f3def1677baf08ab2a3ca17c56879e70fecba2fc4dde4ed108" + "sha256:aec3fdbb8bc9e4bb65f0634b9f551ced63983a529d6a8931817d52fdd0816ddb", + "sha256:fe1d8331dfa7cc0a883b49d75fc76380b2ab2734b220fbb87d774e4fd4b851f8" ], - "version": "==19.2" + "version": "==20.0" }, "pkginfo": { "hashes": [ @@ -407,10 +407,10 @@ }, "py": { "hashes": [ - "sha256:64f65755aee5b381cea27766a3a147c3f15b9b6b9ac88676de66ba2ae36793fa", - "sha256:dc639b046a6e2cff5bbe40194ad65936d6ba360b52b3c3fe1d08a82dd50b5e53" + "sha256:5e27081401262157467ad6e7f851b7aa402c5852dbcb3dae06768434de5752aa", + "sha256:c20fdd83a5dbc0af9efd622bee9a5564e278f6380fffcacc43ba6f43db2813b0" ], - "version": "==1.8.0" + "version": "==1.8.1" }, "pycodestyle": { "hashes": [ @@ -449,18 +449,18 @@ }, "pyparsing": { "hashes": [ - "sha256:20f995ecd72f2a1f4bf6b072b63b22e2eb457836601e76d6e5dfcd75436acc1f", - "sha256:4ca62001be367f01bd3e92ecbb79070272a9d4964dce6a48a82ff0b8bc7e683a" + "sha256:4c830582a84fb022400b85429791bc551f1f4871c33f23e44f353119e92f969f", + "sha256:c342dccb5250c08d45fd6f8b4a559613ca603b57498511740e65cd11a2e7dcec" ], - "version": "==2.4.5" + "version": "==2.4.6" }, "pytest": { "hashes": [ - "sha256:63344a2e3bce2e4d522fd62b4fdebb647c019f1f9e4ca075debbd13219db4418", - "sha256:f67403f33b2b1d25a6756184077394167fe5e2f9d8bdaab30707d19ccec35427" + "sha256:6b571215b5a790f9b41f19f3531c53a45cf6bb8ef2988bc1ff9afb38270b25fa", + "sha256:e41d489ff43948babd0fad7ad5e49b8735d5d55e26628a58673c39ff61d95de4" ], "index": "pypi", - "version": "==5.3.1" + "version": "==5.3.2" }, "pytest-cov": { "hashes": [ @@ -557,18 +557,18 @@ }, "tox": { "hashes": [ - "sha256:7efd010a98339209f3a8292f02909b51c58417bfc6838ab7eca14cf90f96117a", - "sha256:8dd653bf0c6716a435df363c853cad1f037f9d5fddd0abc90d0f48ad06f39d03" + "sha256:06ba73b149bf838d5cd25dc30c2dd2671ae5b2757cf98e5c41a35fe449f131b3", + "sha256:806d0a9217584558cc93747a945a9d9bff10b141a5287f0c8429a08828a22192" ], "index": "pypi", - "version": "==3.14.2" + "version": "==3.14.3" }, "tqdm": { "hashes": [ - "sha256:895796ea8df435b6f502bf122f2b2034a3d48e6d8ff52175606ac1051b0e3e12", - "sha256:e405d16c98fcf30725d0c9d493ed07302a18846b5452de5253030ccd18996f87" + "sha256:4789ccbb6fc122b5a6a85d512e4e41fc5acad77216533a6f2b8ce51e0f265c23", + "sha256:efab950cf7cc1e4d8ee50b2bb9c8e4a89f8307b49e0b2c9cfef3ec4ca26655eb" ], - "version": "==4.40.1" + "version": "==4.41.1" }, "twine": { "hashes": [ @@ -629,17 +629,17 @@ }, "virtualenv": { "hashes": [ - "sha256:116655188441670978117d0ebb6451eb6a7526f9ae0796cc0dee6bd7356909b0", - "sha256:b57776b44f91511866594e477dd10e76a6eb44439cdd7f06dcd30ba4c5bd854f" + "sha256:0d62c70883c0342d59c11d0ddac0d954d0431321a41ab20851facf2b222598f3", + "sha256:55059a7a676e4e19498f1aad09b8313a38fcc0cdbe4fdddc0e9b06946d21b4bb" ], - "version": "==16.7.8" + "version": "==16.7.9" }, "wcwidth": { "hashes": [ - "sha256:3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e", - "sha256:f4ebe71925af7b40a864553f761ed559b43544f8f71746c2d756c7fe788ade7c" + "sha256:8fd29383f539be45b20bd4df0dc29c20ba48654a41e661925e612311e9f3c603", + "sha256:f28b3e8a6483e5d49e7f8949ac1a78314e740333ae305b4ba5defd3e74fb37a8" ], - "version": "==0.1.7" + "version": "==0.1.8" }, "webencodings": { "hashes": [ diff --git a/annofabapi/__version__.py b/annofabapi/__version__.py index 5a983c9e..f8ab8c2e 100644 --- a/annofabapi/__version__.py +++ b/annofabapi/__version__.py @@ -1 +1 @@ -__version__ = '0.23.2' +__version__ = '0.24.0' diff --git a/annofabapi/dataclass/annotation_specs.py b/annofabapi/dataclass/annotation_specs.py index 62fb2725..4202159d 100644 --- a/annofabapi/dataclass/annotation_specs.py +++ b/annofabapi/dataclass/annotation_specs.py @@ -18,6 +18,8 @@ OneOfbooleanintegerstring = Union[bool, int, str] +AdditionalDataRestrictionCondition = Dict[str, Any] + @dataclass_json @dataclass @@ -40,7 +42,7 @@ class Keybind: @dataclass_json @dataclass -class LabelBoundingBoxMetadata: +class LabelV1BoundingBoxMetadata: """ """ @@ -68,7 +70,7 @@ class LabelBoundingBoxMetadata: @dataclass_json @dataclass -class LabelSegmentationMetadata: +class LabelV1SegmentationMetadata: """ """ @@ -167,7 +169,7 @@ class Color: @dataclass_json @dataclass -class AdditionalDataDefinitionChoices: +class AdditionalDataDefinitionV1Choices: """ """ @@ -183,7 +185,7 @@ class AdditionalDataDefinitionChoices: @dataclass_json @dataclass -class AdditionalDataDefinition: +class AdditionalDataDefinitionV1: """ """ @@ -205,7 +207,7 @@ class AdditionalDataDefinition: type: Optional[AdditionalDataDefinitionType] """""" - choices: Optional[List[AdditionalDataDefinitionChoices]] + choices: Optional[List[AdditionalDataDefinitionV1Choices]] """""" regex: Optional[str] @@ -218,6 +220,34 @@ class AdditionalDataDefinition: """リンク属性において、入力を必須とするかどうか""" +@dataclass_json +@dataclass +class AdditionalDataDefinitionV2: + """ + + """ + additional_data_definition_id: Optional[str] + """""" + + read_only: Optional[bool] + """""" + + name: Optional[InternationalizationMessage] + """""" + + default: Optional[OneOfbooleanintegerstring] + """属性の初期値です。 初期値を指定する場合、属性の種類に応じて次の値を指定します。初期値を設定しない場合には空文字を指定します。 * type が flag の場合: 真偽値(`true` or `false`) * type が integer の場合: 整数値 * type が text の場合: 文字列 * type が comment の場合: 文字列 * type が choice の場合: 選択肢(`choices`)の `choice_id` * type が select の場合: 選択肢(`choices`)の `choice_id` 属性の種類に対して有効でない初期値を設定した場合、その設定は無視されます。 なお、トラッキングとリンクには初期値を設定できません。 """ + + keybind: Optional[List[Keybind]] + """""" + + type: Optional[AdditionalDataDefinitionType] + """""" + + choices: Optional[List[AdditionalDataDefinitionV1Choices]] + """""" + + @dataclass_json @dataclass class AnnotationEditorFeature: @@ -245,7 +275,7 @@ class AnnotationEditorFeature: @dataclass_json @dataclass -class Label: +class LabelV1: """ """ @@ -261,13 +291,13 @@ class Label: annotation_type: Optional[AnnotationType] """""" - bounding_box_metadata: Optional[LabelBoundingBoxMetadata] + bounding_box_metadata: Optional[LabelV1BoundingBoxMetadata] """""" - segmentation_metadata: Optional[LabelSegmentationMetadata] + segmentation_metadata: Optional[LabelV1SegmentationMetadata] """""" - additional_data_definitions: Optional[List[AdditionalDataDefinition]] + additional_data_definitions: Optional[List[AdditionalDataDefinitionV1]] """""" color: Optional[Color] @@ -282,14 +312,86 @@ class Label: @dataclass_json @dataclass -class AnnotationSpecs: +class LabelV2: + """ + + """ + label_id: Optional[str] + """""" + + label_name: Optional[InternationalizationMessage] + """""" + + keybind: Optional[List[Keybind]] + """""" + + annotation_type: Optional[AnnotationType] + """""" + + bounding_box_metadata: Optional[LabelV1BoundingBoxMetadata] + """""" + + segmentation_metadata: Optional[LabelV1SegmentationMetadata] + """""" + + additional_data_definitions: Optional[List[str]] + """""" + + color: Optional[Color] + """""" + + annotation_editor_feature: Optional[AnnotationEditorFeature] + """""" + + allow_out_of_image_bounds: Optional[bool] + """""" + + +@dataclass_json +@dataclass +class AdditionalDataRestriction: + """ + + """ + additional_data_definition_id: Optional[str] + """""" + + condition: Optional[AdditionalDataRestrictionCondition] + """""" + + +@dataclass_json +@dataclass +class AnnotationSpecsV1: + """ + + """ + project_id: Optional[str] + """プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) """ + + labels: Optional[List[LabelV1]] + """""" + + inspection_phrases: Optional[List[InspectionPhrase]] + """""" + + +@dataclass_json +@dataclass +class AnnotationSpecsV2: """ """ project_id: Optional[str] """プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) """ - labels: Optional[List[Label]] + labels: Optional[List[LabelV2]] + """""" + + additionals: Optional[List[AdditionalDataDefinitionV2]] + """""" + + restrictions: Optional[List[AdditionalDataRestriction]] """""" inspection_phrases: Optional[List[InspectionPhrase]] diff --git a/annofabapi/dataclass/project.py b/annofabapi/dataclass/project.py index 542531d6..fb0618d4 100644 --- a/annofabapi/dataclass/project.py +++ b/annofabapi/dataclass/project.py @@ -14,7 +14,7 @@ from dataclasses_json import dataclass_json -from annofabapi.models import AssigneeRuleOfResubmittedTask, InputDataType, ProjectStatus +from annofabapi.models import AssigneeRuleOfResubmittedTask, InputDataType, ProjectStatus, TaskAssignmentType @dataclass_json @@ -39,6 +39,9 @@ class ProjectConfiguration: assignee_rule_of_resubmitted_task: Optional[AssigneeRuleOfResubmittedTask] """""" + task_assignment_type: Optional[TaskAssignmentType] + """""" + max_tasks_per_member: Optional[int] """保留中のタスクを除き、1人(オーナー以外)に割り当てられるタスク数上限。未指定の場合は10件として扱う。""" diff --git a/annofabapi/generated_api.py b/annofabapi/generated_api.py index b04cb353..749b903e 100644 --- a/annofabapi/generated_api.py +++ b/annofabapi/generated_api.py @@ -265,7 +265,7 @@ def batch_update_annotations(self, project_id: str, request_body: Optional[Any] authorizations: ProjectAccepter - 複数のアノテーションを一括更新します。 リクエストボディは、1個以上の「操作」オブジェクトを含むJSON配列になります。 操作オブジェクトには、「更新」と「削除」の2通りがあり、それぞれJSONオブジェクト構造が異なります。 これら操作オブジェクトを複数含めることで、1リクエストで複数の更新や削除ができます。 **現時点で、このAPIは複数のアノテーションを修正するためのもので、新しいアノテーションを作成することはできません**。 新しいアノテーションを更新や削除の対象に指定した場合、無視されます。 既に作成済みのアノテーションのうち、リクエストボディの配列に含まれないアノテーションは更新されません。 更新対象のアノテーションのうち、属性配列に含まれない属性は更新されません。 更新対象のアノテーションのラベルを変更する場合、変更後のラベルに含まれない属性は削除されます。 複数の操作のうち、1つでも失敗するとAPIのレスポンス全体としては失敗になります。 成功した部分までは反映されます。 受入が完了しているタスクのアノテーション更新を含む場合、オーナー以上の権限が必要になります。 + 複数のアノテーションを一括更新します。 リクエストボディは、1個以上の「操作」オブジェクトを含むJSON配列になります。 操作オブジェクトには、「更新」と「削除」の2通りがあり、それぞれJSONオブジェクト構造が異なります。 これら操作オブジェクトを複数含めることで、1リクエストで複数の更新や削除ができます。 **現時点で、このAPIは複数のアノテーションを修正するためのもので、新しいアノテーションを作成することはできません**。 新しいアノテーションを更新や削除の対象に指定した場合、無視されます。 既に作成済みのアノテーションのうち、リクエストボディの配列に含まれないアノテーションは更新されません。 更新対象のアノテーションのうち、属性配列に含まれない属性は更新されません。 更新対象のアノテーションのラベルを変更する場合、変更後のラベルに含まれない属性は削除されます。 また、画像全体アノテーションのラベルは変更することができません。 複数の操作のうち、1つでも失敗するとAPIのレスポンス全体としては失敗になります。 成功した部分までは反映されます。 受入が完了しているタスクのアノテーション更新を含む場合、オーナー以上の権限が必要になります。 Args: project_id (str): プロジェクトID (required) @@ -389,34 +389,6 @@ def get_archive_full_with_pro_id(self, project_id: str, **kwargs) -> Tuple[Any, keyword_params: Dict[str, Any] = {} return self._request_wrapper(http_method, url_path, **keyword_params) - def get_outer_with_pro_id_tas_id_inp_dat_id_ann_id(self, project_id: str, task_id: str, input_data_id: str, - annotation_id: str, **kwargs) -> Tuple[Any, requests.Response]: - """【エディタ用】外部ファイル形式のアノテーション取得 - - .. deprecated:: X - - authorizations: AllProjectMember - - - このAPIが返すアノテーションは、エディタ用です。 機械学習などで利用する成果物としてのアノテーションを取得するには、以下をご利用いただけます。 * [getAnnotation](#operation/getAnnotation): 特定のタスク - 入力データのアノテーション取得 * [getAnnotationArchive](#operation/getAnnotationArchive): プロジェクト全体のアノテーション(ZIP) - - Args: - project_id (str): プロジェクトID (required) - task_id (str): タスクID (required) - input_data_id (str): 入力データID (required) - annotation_id (str): アノテーションID (required) - - Returns: - Tuple[, requests.Response] - - - """ - warnings.warn("deprecated", DeprecationWarning) - url_path = f'/projects/{project_id}/tasks/{task_id}/inputs/{input_data_id}/annotation/{annotation_id}/outer' - http_method = 'GET' - keyword_params: Dict[str, Any] = {} - return self._request_wrapper(http_method, url_path, **keyword_params) - def post_annotation_archive_update(self, project_id: str, **kwargs) -> Tuple[Any, requests.Response]: """アノテーションZIP更新開始 @@ -486,9 +458,10 @@ def get_annotation_specs(self, project_id: str, query_params: Optional[Dict[str, project_id (str): プロジェクトID (required) query_params (Dict[str, Any]): Query Parameters history_id (str): 過去のアノテーション仕様を取得する場合、[アノテーション仕様履歴取得](#operation/getAnnotationSpecsHistories)APIで取得した `history_id` の値を指定します。 未指定時は最新のアノテーション仕様を取得します。 + v (str): 取得するアノテーション仕様のフォーマットバージョンを指定します。 Returns: - Tuple[AnnotationSpecs, requests.Response] + Tuple[OneOfAnnotationSpecsV1AnnotationSpecsV2, requests.Response] """ @@ -532,10 +505,10 @@ def put_annotation_specs(self, project_id: str, request_body: Optional[Any] = No Args: project_id (str): プロジェクトID (required) request_body (Any): Request Body - annotation_specs_request (AnnotationSpecsRequest): (required) + unknown_base_type (UNKNOWN_BASE_TYPE): (required) Returns: - Tuple[AnnotationSpecs, requests.Response] + Tuple[AnnotationSpecsV2, requests.Response] """ @@ -2066,6 +2039,33 @@ def put_supplementary_data(self, project_id: str, input_data_id: str, supplement # NOTE: This method is auto generated by OpenAPI Generator ######################################### + def assign_tasks(self, project_id: str, request_body: Optional[Any] = None, + **kwargs) -> Tuple[Any, requests.Response]: + """タスク割当 + + + authorizations: AllProjectMember + + + メンバーもしくは自身にタスクを割当します。 個々のタスクの情報を取得する場合は、[タスク取得](#operation/getTask)を使います。 + + Args: + project_id (str): プロジェクトID (required) + request_body (Any): Request Body + task_assign_request (TaskAssignRequest): (required) + + Returns: + Tuple[List[Task], requests.Response] + + + """ + url_path = f'/projects/{project_id}/assign-tasks' + http_method = 'POST' + keyword_params: Dict[str, Any] = { + 'request_body': request_body, + } + return self._request_wrapper(http_method, url_path, **keyword_params) + def batch_update_tasks(self, project_id: str, request_body: Optional[Any] = None, **kwargs) -> Tuple[Any, requests.Response]: """タスク一括更新 @@ -2314,6 +2314,7 @@ def start_task(self, project_id: str, request_body: Optional[Any] = None, **kwargs) -> Tuple[Any, requests.Response]: """タスク割当 + .. deprecated:: X authorizations: AllProjectMember @@ -2330,6 +2331,7 @@ def start_task(self, project_id: str, request_body: Optional[Any] = None, """ + warnings.warn("deprecated", DeprecationWarning) url_path = f'/projects/{project_id}/start-task' http_method = 'POST' keyword_params: Dict[str, Any] = { diff --git a/annofabapi/generated_api2.py b/annofabapi/generated_api2.py index 4144ed18..b9c779ab 100644 --- a/annofabapi/generated_api2.py +++ b/annofabapi/generated_api2.py @@ -45,9 +45,10 @@ def get_annotation_specs_v2(self, project_id: str, query_params: Optional[Dict[s query_params (Dict[str, Any]): Query Parameters cache (str): CACHE TIMESTAMP history_id (str): 過去のアノテーション仕様を取得する場合、[アノテーション仕様履歴取得](#operation/getAnnotationSpecsHistories)APIで取得した `history_id` の値を指定します。 未指定時は最新のアノテーション仕様を取得します。 + v (str): 取得するアノテーション仕様のフォーマットバージョンを指定します。 Returns: - Tuple[AnnotationSpecs, requests.Response] + Tuple[OneOfAnnotationSpecsV1AnnotationSpecsV2, requests.Response] """ diff --git a/annofabapi/models.py b/annofabapi/models.py index 1e83ecbb..86792f94 100644 --- a/annofabapi/models.py +++ b/annofabapi/models.py @@ -256,7 +256,23 @@ class AccountAuthority(Enum): """ -AdditionalDataDefinition = Dict[str, Any] + +class AdditionalDataDefinitionType(Enum): + """ + * `flag` - 真偽値 * `integer` - 整数値 * `text` - 自由記述(1行) * `comment` - 自由記述(複数行) * `choice` - 選択肢(ラジオボタン式) * `select` - 選択肢(ドロップダウン式) * `tracking` - 自由記述 (トラッキングID自動挿入) * `link` - アノテーションリンク + """ + + FLAG = "flag" + INTEGER = "integer" + TEXT = "text" + COMMENT = "comment" + CHOICE = "choice" + SELECT = "select" + TRACKING = "tracking" + LINK = "link" + + +AdditionalDataDefinitionV1 = Dict[str, Any] """ @@ -274,7 +290,7 @@ class AccountAuthority(Enum): * type: AdditionalDataDefinitionType -* choices: List[AdditionalDataDefinitionChoices] +* choices: List[AdditionalDataDefinitionV1Choices] * regex: str @@ -285,7 +301,7 @@ class AccountAuthority(Enum): """ -AdditionalDataDefinitionChoices = Dict[str, Any] +AdditionalDataDefinitionV1Choices = Dict[str, Any] """ @@ -300,21 +316,153 @@ class AccountAuthority(Enum): """ +AdditionalDataDefinitionV2 = Dict[str, Any] +""" -class AdditionalDataDefinitionType(Enum): - """ - * `flag` - 真偽値 * `integer` - 整数値 * `text` - 自由記述(1行) * `comment` - 自由記述(複数行) * `choice` - 選択肢(ラジオボタン式) * `select` - 選択肢(ドロップダウン式) * `tracking` - 自由記述 (トラッキングID自動挿入) * `link` - アノテーションリンク - """ - FLAG = "flag" - INTEGER = "integer" - TEXT = "text" - COMMENT = "comment" - CHOICE = "choice" - SELECT = "select" - TRACKING = "tracking" - LINK = "link" +Kyes of Dict + +* additional_data_definition_id: str + +* read_only: bool + +* name: InternationalizationMessage + +* default: OneOfbooleanintegerstring + 属性の初期値です。 初期値を指定する場合、属性の種類に応じて次の値を指定します。初期値を設定しない場合には空文字を指定します。 * type が flag の場合: 真偽値(`true` or `false`) * type が integer の場合: 整数値 * type が text の場合: 文字列 * type が comment の場合: 文字列 * type が choice の場合: 選択肢(`choices`)の `choice_id` * type が select の場合: 選択肢(`choices`)の `choice_id` 属性の種類に対して有効でない初期値を設定した場合、その設定は無視されます。 なお、トラッキングとリンクには初期値を設定できません。 +* keybind: List[Keybind] + +* type: AdditionalDataDefinitionType + +* choices: List[AdditionalDataDefinitionV1Choices] + + +""" + +AdditionalDataRestriction = Dict[str, Any] +""" + + +Kyes of Dict + +* additional_data_definition_id: str + +* condition: AdditionalDataRestrictionCondition + + +""" + +AdditionalDataRestrictionCondition = Dict[str, Any] +""" + + +Kyes of Dict + +* type: str + +* enable: bool + +* value: str + +* values: str + +* premise: AdditionalDataRestriction + +* condition: AdditionalDataRestrictionCondition + + +""" + +AdditionalDataRestrictionConditionCanInput = Dict[str, Any] +""" +enable=false とすることで、入力を許可しないようにできます。 Imply との組み合わせで、特定条件下のみ入力を許すといった制限ができます。 + +Kyes of Dict + +* type: str + +* enable: bool + + +""" + +AdditionalDataRestrictionConditionEquals = Dict[str, Any] +""" +指定された値と等しいことを要求します。 + +Kyes of Dict + +* type: str + +* value: str + + +""" + +AdditionalDataRestrictionConditionHasLabel = Dict[str, Any] +""" +リンク属性において、リンク先として指定可能なラベルIDを制限します。 + +Kyes of Dict + +* type: str + +* values: str + + +""" + +AdditionalDataRestrictionConditionImply = Dict[str, Any] +""" +premise で指定された条件を満たすとき、condition で指定された条件を満たすことを要求します。 + +Kyes of Dict + +* premise: AdditionalDataRestriction + +* condition: AdditionalDataRestrictionCondition + + +""" + +AdditionalDataRestrictionConditionMatches = Dict[str, Any] +""" +指定された正規表現に合致することを要求します。 + +Kyes of Dict + +* type: str + +* value: str + + +""" + +AdditionalDataRestrictionConditionNotEquals = Dict[str, Any] +""" +指定された値と異なることを要求します。 value に \"\" を指定することで、入力を必須とすることができます。 + +Kyes of Dict + +* type: str + +* value: str + + +""" + +AdditionalDataRestrictionConditionNotMatches = Dict[str, Any] +""" +指定された正規表現に合致しないことを要求します。 + +Kyes of Dict +* type: str + +* value: str + + +""" AdditionalDataValue = Dict[str, Any] """ @@ -520,52 +668,58 @@ class AnnotationDataHoldingType(Enum): """ -AnnotationSpecs = Dict[str, Any] +AnnotationSpecsHistory = Dict[str, Any] """ Kyes of Dict +* history_id: str + * project_id: str プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) -* labels: List[Label] +* updated_datetime: str -* inspection_phrases: List[InspectionPhrase] +* url: str + +* account_id: str + +* comment: str """ -AnnotationSpecsHistory = Dict[str, Any] +AnnotationSpecsRequestV1 = Dict[str, Any] """ Kyes of Dict -* history_id: str +* labels: List[LabelV1] -* project_id: str - プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) -* updated_datetime: str - -* url: str - -* account_id: str +* inspection_phrases: List[InspectionPhrase] * comment: str +* auto_marking: bool + trueが指定された場合、各統計グラフにマーカーを自動追加します。 マーカーのタイトルには `comment` に指定された文字列が設定されます。 `comment` が指定されていなかった場合は \"アノテーション仕様の変更\" という文字列が設定されます。 """ -AnnotationSpecsRequest = Dict[str, Any] +AnnotationSpecsRequestV2 = Dict[str, Any] """ Kyes of Dict -* labels: List[Label] - ラベル +* labels: List[LabelV2] + +* additionals: List[AdditionalDataDefinitionV2] + +* restrictions: List[AdditionalDataRestriction] + * inspection_phrases: List[InspectionPhrase] - 定型指摘 + * comment: str * auto_marking: bool @@ -573,6 +727,40 @@ class AnnotationDataHoldingType(Enum): """ +AnnotationSpecsV1 = Dict[str, Any] +""" + + +Kyes of Dict + +* project_id: str + プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) +* labels: List[LabelV1] + +* inspection_phrases: List[InspectionPhrase] + + +""" + +AnnotationSpecsV2 = Dict[str, Any] +""" + + +Kyes of Dict + +* project_id: str + プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) +* labels: List[LabelV2] + +* additionals: List[AdditionalDataDefinitionV2] + +* restrictions: List[AdditionalDataRestriction] + +* inspection_phrases: List[InspectionPhrase] + + +""" + class AnnotationType(Enum): """ @@ -2103,7 +2291,22 @@ class JobType(Enum): """ -Label = Dict[str, Any] +LabelStatistics = Dict[str, Any] +""" + + +Kyes of Dict + +* label_id: str + +* completed: int + ラベルごとの受入が完了したアノテーション数 +* wip: int + ラベルごとの受入が完了していないアノテーション数 + +""" + +LabelV1 = Dict[str, Any] """ @@ -2117,11 +2320,11 @@ class JobType(Enum): * annotation_type: AnnotationType -* bounding_box_metadata: LabelBoundingBoxMetadata +* bounding_box_metadata: LabelV1BoundingBoxMetadata -* segmentation_metadata: LabelSegmentationMetadata +* segmentation_metadata: LabelV1SegmentationMetadata -* additional_data_definitions: List[AdditionalDataDefinition] +* additional_data_definitions: List[AdditionalDataDefinitionV1] * color: Color @@ -2132,7 +2335,7 @@ class JobType(Enum): """ -LabelBoundingBoxMetadata = Dict[str, Any] +LabelV1BoundingBoxMetadata = Dict[str, Any] """ @@ -2155,7 +2358,7 @@ class JobType(Enum): """ -LabelSegmentationMetadata = Dict[str, Any] +LabelV1SegmentationMetadata = Dict[str, Any] """ @@ -2172,7 +2375,7 @@ class JobType(Enum): """ -LabelStatistics = Dict[str, Any] +LabelV2 = Dict[str, Any] """ @@ -2180,10 +2383,24 @@ class JobType(Enum): * label_id: str -* completed: int - ラベルごとの受入が完了したアノテーション数 -* wip: int - ラベルごとの受入が完了していないアノテーション数 +* label_name: InternationalizationMessage + +* keybind: List[Keybind] + +* annotation_type: AnnotationType + +* bounding_box_metadata: LabelV1BoundingBoxMetadata + +* segmentation_metadata: LabelV1SegmentationMetadata + +* additional_data_definitions: List[str] + +* color: Color + +* annotation_editor_feature: AnnotationEditorFeature + +* allow_out_of_image_bounds: bool + """ @@ -2566,6 +2783,8 @@ class PricePlan(Enum): 検査回数。 * 0回:教師付け -> 受入 * 1回:教師付け -> 検査 -> 受入 * n回(n >= 2):教師付け -> 検査1 -> ... -> 検査n -> 受入 * assignee_rule_of_resubmitted_task: AssigneeRuleOfResubmittedTask +* task_assignment_type: TaskAssignmentType + * max_tasks_per_member: int 保留中のタスクを除き、1人(オーナー以外)に割り当てられるタスク数上限。未指定の場合は10件として扱う。 * max_tasks_per_member_including_hold: int @@ -3078,6 +3297,66 @@ class SupplementaryDataType(Enum): """ + +class TaskAssginmentType(Enum): + """ + * `random` - タスクフェーズのみを指定してランダムにタスクを自身に割当する方式です。 * `selection` - 担当者とタスクを明示的に指定してタスクを割当する方式です。プロジェクトオーナーもしくはチェッカーのみ、自身以外のプロジェクトメンバーを担当者に指定できます。 * `random_and_selection` - ランダム割当と選択割当の両機能を使用する方式です。 + """ + + RANDOM = "random" + SELECTION = "selection" + RANDOM_AND_SELECTION = "random_and_selection" + + +TaskAssignRequest = Dict[str, Any] +""" + + +Kyes of Dict + +* request_type: OneOfTaskAssignRequestTypeRandomTaskAssignRequestTypeSelection + * `TaskAssignRequestTypeRandom`: タスクフェーズのみを指定してランダムにタスクを自身に割当します。プロジェクト設定でタスクのランダム割当を有効にした場合のみ利用できます。 * `TaskAssignRequestTypeSelection`: 担当者とタスクを明示的に指定してタスクを割当します。プロジェクトオーナーもしくはチェッカーのみ、自身以外のプロジェクトメンバーを担当者に指定できます。プロジェクト設定でタスクの選択割当を有効にした場合のみ利用できます。 + +""" + +TaskAssignRequestTypeRandom = Dict[str, Any] +""" + + +Kyes of Dict + +* phase: TaskPhase + 割当するタスクフェーズ +* type: str + Random + +""" + +TaskAssignRequestTypeSelection = Dict[str, Any] +""" + + +Kyes of Dict + +* user_id: str + タスクを誰に割当するか +* task_ids: List[str] + 割当するタスクのID +* type: str + Selection + +""" + + +class TaskAssignmentType(Enum): + """ + """ + + RANDOM = "random" + SELECTION = "selection" + RANDOM_AND_SELECTION = "random_and_selection" + + TaskGenerateRequest = Dict[str, Any] """ @@ -3216,7 +3495,7 @@ class SupplementaryDataType(Enum): * last_updated_datetime: str 新規作成時は未指定、更新時は必須(更新前の日時) * account_id: str - + 変更後の担当者のアカウントID """ diff --git a/annofabapi/wrapper.py b/annofabapi/wrapper.py index 59521a2b..423095f1 100644 --- a/annofabapi/wrapper.py +++ b/annofabapi/wrapper.py @@ -12,8 +12,8 @@ import annofabapi.utils from annofabapi import AnnofabApi from annofabapi.exceptions import AnnofabApiException -from annofabapi.models import (AnnotationSpecs, InputData, Inspection, InspectionStatus, Instruction, JobInfo, JobType, - MyOrganization, Organization, OrganizationMember, Project, ProjectMember, +from annofabapi.models import (AnnotationSpecsV1, InputData, Inspection, InspectionStatus, Instruction, JobInfo, + JobType, MyOrganization, Organization, OrganizationMember, Project, ProjectMember, SupplementaryData, Task) from annofabapi.utils import allow_404_error @@ -170,7 +170,7 @@ def get_all_annotation_list(self, project_id: str, # Public Method : AnnotationSpecs ######################################### def copy_annotation_specs(self, src_project_id: str, dest_project_id: str, - comment: Optional[str] = None) -> AnnotationSpecs: + comment: Optional[str] = None) -> AnnotationSpecsV1: """ アノテーション仕様を、別のプロジェクトにコピーする。 @@ -717,15 +717,13 @@ def to_inactive(arg_member): ######################################### # Public Method : Task ######################################### - def initiate_tasks_generation_by_csv(self, project_id: str, csvfile_path: str, - task_id_prefix: str) -> Dict[str, Any]: + def initiate_tasks_generation_by_csv(self, project_id: str, csvfile_path: str) -> Dict[str, Any]: """ - CSV Fileでタスクを生成する + タスクID,入力データ名,入力データID」を1行毎に指定したCSVを使って、タスクを生成する Args: project_id: プロジェクトID csvfile_path: CSVファイルのパス - task_id_prefix: 生成するタスクIDのプレフィックス Returns: `initiate_tasks_generation` APIのContent @@ -739,7 +737,6 @@ def initiate_tasks_generation_by_csv(self, project_id: str, csvfile_path: str, '_type': 'ByInputDataCsv', 'csv_data_path': s3_path, }, - 'task_id_prefix': task_id_prefix, 'project_last_updated_datetime': project_last_updated_datetime } return self.api.initiate_tasks_generation(project_id, request_body=request_body)[0] diff --git a/generate/generate.sh b/generate/generate.sh index 01bfb9b5..e5b6e313 100755 --- a/generate/generate.sh +++ b/generate/generate.sh @@ -130,18 +130,23 @@ cat partial-header/dataclass/common.py partial-header/dataclass/annotation.py \ # Annotation Specs declare -a model_files=(${MODELS_DIR}/keybind.py \ - ${MODELS_DIR}/label_bounding_box_metadata.py \ - ${MODELS_DIR}/label_segmentation_metadata.py \ + ${MODELS_DIR}/label_v1_bounding_box_metadata.py \ + ${MODELS_DIR}/label_v1_segmentation_metadata.py \ ${MODELS_DIR}/internationalization_message_messages.py \ ${MODELS_DIR}/internationalization_message.py \ ${MODELS_DIR}/inspection_phrase.py \ ${MODELS_DIR}/annotation_specs_history.py \ ${MODELS_DIR}/color.py \ - ${MODELS_DIR}/additional_data_definition_choices.py \ - ${MODELS_DIR}/additional_data_definition.py \ + ${MODELS_DIR}/additional_data_definition_v1_choices.py \ + ${MODELS_DIR}/additional_data_definition_v1.py \ + ${MODELS_DIR}/additional_data_definition_v2.py \ ${MODELS_DIR}/annotation_editor_feature.py \ - ${MODELS_DIR}/label.py \ - ${MODELS_DIR}/annotation_specs.py) + ${MODELS_DIR}/label_v1.py \ + ${MODELS_DIR}/label_v2.py \ + ${MODELS_DIR}/additional_data_restriction.py \ + ${MODELS_DIR}/annotation_specs_v1.py \ + ${MODELS_DIR}/annotation_specs_v2.py \ +) cat partial-header/dataclass/common.py partial-header/dataclass/annotation_specs.py \ ${model_files[@]} > ../annofabapi/dataclass/annotation_specs.py diff --git a/generate/partial-header/dataclass/annotation_specs.py b/generate/partial-header/dataclass/annotation_specs.py index cdc69483..c48d5196 100644 --- a/generate/partial-header/dataclass/annotation_specs.py +++ b/generate/partial-header/dataclass/annotation_specs.py @@ -1,3 +1,5 @@ from annofabapi.models import (AdditionalDataDefinitionType, AnnotationType) OneOfbooleanintegerstring = Union[bool, int, str] + +AdditionalDataRestrictionCondition = Dict[str, Any] diff --git a/generate/partial-header/dataclass/project.py b/generate/partial-header/dataclass/project.py index 4e154b39..43cbb88b 100644 --- a/generate/partial-header/dataclass/project.py +++ b/generate/partial-header/dataclass/project.py @@ -1,2 +1,2 @@ -from annofabapi.models import AssigneeRuleOfResubmittedTask, ProjectStatus, InputDataType +from annofabapi.models import AssigneeRuleOfResubmittedTask, ProjectStatus, InputDataType, TaskAssignmentType diff --git a/generate/swagger/swagger-api-components.yaml b/generate/swagger/swagger-api-components.yaml index 0c556086..c1ce2867 100644 --- a/generate/swagger/swagger-api-components.yaml +++ b/generate/swagger/swagger-api-components.yaml @@ -908,6 +908,12 @@ TaskHistoryId: type: string example: "12345678-abcd-1234-abcd-1234abcd5678" + TaskAssignmentType: + type: string + enum: + - random + - selection + - random_and_selection AnnotationId: type: string example: "12345678-abcd-1234-abcd-1234abcd5678" @@ -1027,6 +1033,10 @@ description: 再提出されたタスクの検査/受入担当者ルール。 $ref: "#/components/schemas/AssigneeRuleOfResubmittedTask" default: no_assignee + task_assignment_type: + description: タスクの割当方式。 + $ref: "#/components/schemas/TaskAssignmentType" + default: random max_tasks_per_member: description: 保留中のタスクを除き、1人(オーナー以外)に割り当てられるタスク数上限。未指定の場合は10件として扱う。 type: integer @@ -1074,6 +1084,16 @@ last_tasks_updated_datetime: type: string format: date-time + TaskAssginmentType: + type: string + enum: + - random + - selection + - random_and_selection + description: | + * `random` - タスクフェーズのみを指定してランダムにタスクを自身に割当する方式です。 + * `selection` - 担当者とタスクを明示的に指定してタスクを割当する方式です。プロジェクトオーナーもしくはチェッカーのみ、自身以外のプロジェクトメンバーを担当者に指定できます。 + * `random_and_selection` - ランダム割当と選択割当の両機能を使用する方式です。 JobInfo: type: object properties: @@ -1658,7 +1678,7 @@ $ref: "#/components/schemas/Marker" last_updated_datetime: $ref: "#/components/schemas/LastUpdatedDatetime" - AnnotationSpecs: + AnnotationSpecsV1: type: object properties: project_id: @@ -1666,26 +1686,71 @@ labels: type: array items: - $ref: "#/components/schemas/Label" + $ref: "#/components/schemas/LabelV1" inspection_phrases: type: array items: $ref: "#/components/schemas/InspectionPhrase" - AnnotationSpecsRequest: + AnnotationSpecsV2: type: object properties: + project_id: + $ref: "#/components/schemas/ProjectId" labels: type: array items: - $ref: "#/components/schemas/Label" - description: | - ラベル + $ref: "#/components/schemas/LabelV2" + additionals: + type: array + items: + $ref: "#/components/schemas/AdditionalDataDefinitionV2" + restrictions: + type: array + items: + $ref: "#/components/schemas/AdditionalDataRestriction" inspection_phrases: type: array items: $ref: "#/components/schemas/InspectionPhrase" + AnnotationSpecsRequestV1: + type: object + properties: + labels: + type: array + items: + $ref: "#/components/schemas/LabelV1" + inspection_phrases: + type: array + items: + $ref: "#/components/schemas/InspectionPhrase" + comment: + type: string + autoMarking: + type: boolean + default: false description: | - 定型指摘 + trueが指定された場合、各統計グラフにマーカーを自動追加します。 + マーカーのタイトルには `comment` に指定された文字列が設定されます。 + `comment` が指定されていなかった場合は "アノテーション仕様の変更" という文字列が設定されます。 + AnnotationSpecsRequestV2: + type: object + properties: + labels: + type: array + items: + $ref: "#/components/schemas/LabelV2" + additionals: + type: array + items: + $ref: "#/components/schemas/AdditionalDataDefinitionV2" + restrictions: + type: array + items: + $ref: "#/components/schemas/AdditionalDataRestriction" + inspection_phrases: + type: array + items: + $ref: "#/components/schemas/InspectionPhrase" comment: type: string autoMarking: @@ -1758,7 +1823,7 @@ * `select` - 選択肢(ドロップダウン式) * `tracking` - 自由記述 (トラッキングID自動挿入) * `link` - アノテーションリンク - Label: + LabelV1: type: object properties: label_id: @@ -1806,7 +1871,63 @@ additional_data_definitions: type: array items: - $ref: "#/components/schemas/AdditionalDataDefinition" + $ref: "#/components/schemas/AdditionalDataDefinitionV1" + color: + $ref: "#/components/schemas/Color" + annotation_editor_feature: + $ref: "#/components/schemas/AnnotationEditorFeature" + allow_out_of_image_bounds: + type: boolean + default: false + LabelV2: + type: object + properties: + label_id: + $ref: "#/components/schemas/LabelId" + label_name: + $ref: "#/components/schemas/InternationalizationMessage" + keybind: + type: array + items: + $ref: "#/components/schemas/Keybind" + annotation_type: + $ref: "#/components/schemas/AnnotationType" + bounding_box_metadata: + type: object + properties: + min_width: + type: integer + min_height: + type: integer + min_warn_rule: + type: string + default: or + min_area: + type: integer + minimum: 1 + maximum: 1000000 + max_vertices: + type: integer + min_vertices: + type: integer + tolerance: + type: integer + segmentation_metadata: + type: object + properties: + min_width: + type: integer + min_height: + type: integer + min_warn_rule: + type: string + default: or + tolerance: + type: integer + additional_data_definitions: + type: array + items: + $ref: "#/components/schemas/AdditionalDataDefinitionId" color: $ref: "#/components/schemas/Color" annotation_editor_feature: @@ -1844,7 +1965,7 @@ type: boolean fill_near: type: boolean - AdditionalDataDefinition: + AdditionalDataDefinitionV1: type: object properties: additional_data_definition_id: @@ -1903,6 +2024,138 @@ required: type: boolean description: リンク属性において、入力を必須とするかどうか + AdditionalDataDefinitionV2: + type: object + properties: + additional_data_definition_id: + $ref: "#/components/schemas/AdditionalDataDefinitionId" + read_only: + type: boolean + default: false + name: + $ref: "#/components/schemas/InternationalizationMessage" + default: + oneOf: + - type: boolean + - type: integer + - type: string + description: | + 属性の初期値です。 + + 初期値を指定する場合、属性の種類に応じて次の値を指定します。初期値を設定しない場合には空文字を指定します。 + + * type が flag の場合: 真偽値(`true` or `false`) + * type が integer の場合: 整数値 + * type が text の場合: 文字列 + * type が comment の場合: 文字列 + * type が choice の場合: 選択肢(`choices`)の `choice_id` + * type が select の場合: 選択肢(`choices`)の `choice_id` + + 属性の種類に対して有効でない初期値を設定した場合、その設定は無視されます。 + + なお、トラッキングとリンクには初期値を設定できません。 + keybind: + type: array + items: + $ref: "#/components/schemas/Keybind" + type: + $ref: "#/components/schemas/AdditionalDataDefinitionType" + choices: + type: array + items: + type: object + properties: + choice_id: + $ref: "#/components/schemas/ChoiceId" + name: + $ref: "#/components/schemas/InternationalizationMessage" + keybind: + type: array + items: + $ref: "#/components/schemas/Keybind" + AdditionalDataRestriction: + type: object + properties: + additional_data_definition_id: + $ref: "#/components/schemas/AdditionalDataDefinitionId" + condition: + $ref: "#/components/schemas/AdditionalDataRestrictionCondition" + AdditionalDataRestrictionCondition: + oneOf: + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionCanInput" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionEquals" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionNotEquals" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionMatches" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionNotMatches" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionHasLabel" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionImply" + AdditionalDataRestrictionConditionCanInput: + type: object + description: | + enable=false とすることで、入力を許可しないようにできます。 + Imply との組み合わせで、特定条件下のみ入力を許すといった制限ができます。 + properties: + _type: + type: string + example: "CanInput" + enable: + type: boolean + AdditionalDataRestrictionConditionEquals: + type: object + description: 指定された値と等しいことを要求します。 + properties: + _type: + type: string + example: "Equals" + value: + type: string + AdditionalDataRestrictionConditionNotEquals: + type: object + description: | + 指定された値と異なることを要求します。 + value に "" を指定することで、入力を必須とすることができます。 + properties: + _type: + type: string + example: "NotEquals" + value: + type: string + AdditionalDataRestrictionConditionMatches: + type: object + description: 指定された正規表現に合致することを要求します。 + properties: + _type: + type: string + example: "Matches" + value: + type: string + AdditionalDataRestrictionConditionNotMatches: + type: object + description: 指定された正規表現に合致しないことを要求します。 + properties: + _type: + type: string + example: "NotMatches" + value: + type: string + AdditionalDataRestrictionConditionHasLabel: + type: object + description: リンク属性において、リンク先として指定可能なラベルIDを制限します。 + properties: + _type: + type: string + example: "HasLabel" + values: + type: string + AdditionalDataRestrictionConditionImply: + type: object + description: | + premise で指定された条件を満たすとき、condition で指定された条件を満たすことを要求します。 + properties: + premise: + $ref: "#/components/schemas/AdditionalDataRestriction" + condition: + $ref: "#/components/schemas/AdditionalDataRestrictionCondition" Keybind: type: object properties: @@ -2115,7 +2368,7 @@ account_id: allOf: - $ref: "#/components/schemas/AccountId" - - description: 変更後の担当者のアカウントID + description: 変更後の担当者のアカウントID TaskStart: type: object properties: @@ -2123,6 +2376,50 @@ allOf: - $ref: "#/components/schemas/TaskPhase" - description: 開始するタスクのフェーズ + TaskAssignRequest: + type: object + required: + - request_type + properties: + request_type: + description: | + * `TaskAssignRequestTypeRandom`: タスクフェーズのみを指定してランダムにタスクを自身に割当します。プロジェクト設定でタスクのランダム割当を有効にした場合のみ利用できます。 + * `TaskAssignRequestTypeSelection`: 担当者とタスクを明示的に指定してタスクを割当します。プロジェクトオーナーもしくはチェッカーのみ、自身以外のプロジェクトメンバーを担当者に指定できます。プロジェクト設定でタスクの選択割当を有効にした場合のみ利用できます。 + oneOf: + - $ref: "#/components/schemas/TaskAssignRequestTypeRandom" + - $ref: "#/components/schemas/TaskAssignRequestTypeSelection" + TaskAssignRequestTypeRandom: + type: object + required: + - phase + properties: + phase: + description: 割当するタスクフェーズ + allOf: + - $ref: "#/components/schemas/TaskPhase" + _type: + type: string + description: Random + example: "Random" + TaskAssignRequestTypeSelection: + type: object + required: + - user_id + - task_ids + properties: + user_id: + description: タスクを誰に割当するか + allOf: + - $ref: "#/components/schemas/UserId" + task_ids: + description: 割当するタスクのID + type: array + items: + $ref: "#/components/schemas/TaskId" + _type: + type: string + description: Selection + example: "Selection" TaskHistoryShort: description: タスクのあるフェーズを誰が担当したかを表します。 type: object diff --git a/generate/swagger/swagger.v2.yaml b/generate/swagger/swagger.v2.yaml index 5468e5d1..9d801b93 100644 --- a/generate/swagger/swagger.v2.yaml +++ b/generate/swagger/swagger.v2.yaml @@ -76,7 +76,7 @@ info: WebhookID | プロジェクト内で一意 入力データセットID | 組織内で一意 - version: 0.68.1 + version: 0.69.1 title: AnnoFab Web API x-logo: url: "https://annofab.com/images/logo_landscape.png" @@ -570,13 +570,24 @@ paths: schema: type: string example: "123456789" + - name: v + in: query + description: | + 取得するアノテーション仕様のフォーマットバージョンを指定します。 + required: false + schema: + type: string + default: "1" + example: "2" responses: 200: description: 正常 content: application/json: schema: - $ref: "#/components/schemas/AnnotationSpecs" + oneOf: + - $ref: "#/components/schemas/AnnotationSpecsV1" + - $ref: "#/components/schemas/AnnotationSpecsV2" 401: $ref: "#/components/responses/ErrorUnauthorizedApi" 404: @@ -1531,6 +1542,12 @@ components: TaskHistoryId: type: string example: "12345678-abcd-1234-abcd-1234abcd5678" + TaskAssignmentType: + type: string + enum: + - random + - selection + - random_and_selection AnnotationId: type: string example: "12345678-abcd-1234-abcd-1234abcd5678" @@ -1650,6 +1667,10 @@ components: description: 再提出されたタスクの検査/受入担当者ルール。 $ref: "#/components/schemas/AssigneeRuleOfResubmittedTask" default: no_assignee + task_assignment_type: + description: タスクの割当方式。 + $ref: "#/components/schemas/TaskAssignmentType" + default: random max_tasks_per_member: description: 保留中のタスクを除き、1人(オーナー以外)に割り当てられるタスク数上限。未指定の場合は10件として扱う。 type: integer @@ -1697,6 +1718,16 @@ components: last_tasks_updated_datetime: type: string format: date-time + TaskAssginmentType: + type: string + enum: + - random + - selection + - random_and_selection + description: | + * `random` - タスクフェーズのみを指定してランダムにタスクを自身に割当する方式です。 + * `selection` - 担当者とタスクを明示的に指定してタスクを割当する方式です。プロジェクトオーナーもしくはチェッカーのみ、自身以外のプロジェクトメンバーを担当者に指定できます。 + * `random_and_selection` - ランダム割当と選択割当の両機能を使用する方式です。 JobInfo: type: object properties: @@ -2281,7 +2312,20 @@ components: $ref: "#/components/schemas/Marker" last_updated_datetime: $ref: "#/components/schemas/LastUpdatedDatetime" - AnnotationSpecs: + AnnotationSpecsV1: + type: object + properties: + project_id: + $ref: "#/components/schemas/ProjectId" + labels: + type: array + items: + $ref: "#/components/schemas/LabelV1" + inspection_phrases: + type: array + items: + $ref: "#/components/schemas/InspectionPhrase" + AnnotationSpecsV2: type: object properties: project_id: @@ -2289,26 +2333,58 @@ components: labels: type: array items: - $ref: "#/components/schemas/Label" + $ref: "#/components/schemas/LabelV2" + additionals: + type: array + items: + $ref: "#/components/schemas/AdditionalDataDefinitionV2" + restrictions: + type: array + items: + $ref: "#/components/schemas/AdditionalDataRestriction" inspection_phrases: type: array items: $ref: "#/components/schemas/InspectionPhrase" - AnnotationSpecsRequest: + AnnotationSpecsRequestV1: type: object properties: labels: type: array items: - $ref: "#/components/schemas/Label" - description: | - ラベル + $ref: "#/components/schemas/LabelV1" inspection_phrases: type: array items: $ref: "#/components/schemas/InspectionPhrase" + comment: + type: string + autoMarking: + type: boolean + default: false description: | - 定型指摘 + trueが指定された場合、各統計グラフにマーカーを自動追加します。 + マーカーのタイトルには `comment` に指定された文字列が設定されます。 + `comment` が指定されていなかった場合は "アノテーション仕様の変更" という文字列が設定されます。 + AnnotationSpecsRequestV2: + type: object + properties: + labels: + type: array + items: + $ref: "#/components/schemas/LabelV2" + additionals: + type: array + items: + $ref: "#/components/schemas/AdditionalDataDefinitionV2" + restrictions: + type: array + items: + $ref: "#/components/schemas/AdditionalDataRestriction" + inspection_phrases: + type: array + items: + $ref: "#/components/schemas/InspectionPhrase" comment: type: string autoMarking: @@ -2381,7 +2457,63 @@ components: * `select` - 選択肢(ドロップダウン式) * `tracking` - 自由記述 (トラッキングID自動挿入) * `link` - アノテーションリンク - Label: + LabelV1: + type: object + properties: + label_id: + $ref: "#/components/schemas/LabelId" + label_name: + $ref: "#/components/schemas/InternationalizationMessage" + keybind: + type: array + items: + $ref: "#/components/schemas/Keybind" + annotation_type: + $ref: "#/components/schemas/AnnotationType" + bounding_box_metadata: + type: object + properties: + min_width: + type: integer + min_height: + type: integer + min_warn_rule: + type: string + default: or + min_area: + type: integer + minimum: 1 + maximum: 1000000 + max_vertices: + type: integer + min_vertices: + type: integer + tolerance: + type: integer + segmentation_metadata: + type: object + properties: + min_width: + type: integer + min_height: + type: integer + min_warn_rule: + type: string + default: or + tolerance: + type: integer + additional_data_definitions: + type: array + items: + $ref: "#/components/schemas/AdditionalDataDefinitionV1" + color: + $ref: "#/components/schemas/Color" + annotation_editor_feature: + $ref: "#/components/schemas/AnnotationEditorFeature" + allow_out_of_image_bounds: + type: boolean + default: false + LabelV2: type: object properties: label_id: @@ -2429,7 +2561,7 @@ components: additional_data_definitions: type: array items: - $ref: "#/components/schemas/AdditionalDataDefinition" + $ref: "#/components/schemas/AdditionalDataDefinitionId" color: $ref: "#/components/schemas/Color" annotation_editor_feature: @@ -2467,7 +2599,7 @@ components: type: boolean fill_near: type: boolean - AdditionalDataDefinition: + AdditionalDataDefinitionV1: type: object properties: additional_data_definition_id: @@ -2526,6 +2658,138 @@ components: required: type: boolean description: リンク属性において、入力を必須とするかどうか + AdditionalDataDefinitionV2: + type: object + properties: + additional_data_definition_id: + $ref: "#/components/schemas/AdditionalDataDefinitionId" + read_only: + type: boolean + default: false + name: + $ref: "#/components/schemas/InternationalizationMessage" + default: + oneOf: + - type: boolean + - type: integer + - type: string + description: | + 属性の初期値です。 + + 初期値を指定する場合、属性の種類に応じて次の値を指定します。初期値を設定しない場合には空文字を指定します。 + + * type が flag の場合: 真偽値(`true` or `false`) + * type が integer の場合: 整数値 + * type が text の場合: 文字列 + * type が comment の場合: 文字列 + * type が choice の場合: 選択肢(`choices`)の `choice_id` + * type が select の場合: 選択肢(`choices`)の `choice_id` + + 属性の種類に対して有効でない初期値を設定した場合、その設定は無視されます。 + + なお、トラッキングとリンクには初期値を設定できません。 + keybind: + type: array + items: + $ref: "#/components/schemas/Keybind" + type: + $ref: "#/components/schemas/AdditionalDataDefinitionType" + choices: + type: array + items: + type: object + properties: + choice_id: + $ref: "#/components/schemas/ChoiceId" + name: + $ref: "#/components/schemas/InternationalizationMessage" + keybind: + type: array + items: + $ref: "#/components/schemas/Keybind" + AdditionalDataRestriction: + type: object + properties: + additional_data_definition_id: + $ref: "#/components/schemas/AdditionalDataDefinitionId" + condition: + $ref: "#/components/schemas/AdditionalDataRestrictionCondition" + AdditionalDataRestrictionCondition: + oneOf: + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionCanInput" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionEquals" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionNotEquals" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionMatches" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionNotMatches" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionHasLabel" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionImply" + AdditionalDataRestrictionConditionCanInput: + type: object + description: | + enable=false とすることで、入力を許可しないようにできます。 + Imply との組み合わせで、特定条件下のみ入力を許すといった制限ができます。 + properties: + _type: + type: string + example: "CanInput" + enable: + type: boolean + AdditionalDataRestrictionConditionEquals: + type: object + description: 指定された値と等しいことを要求します。 + properties: + _type: + type: string + example: "Equals" + value: + type: string + AdditionalDataRestrictionConditionNotEquals: + type: object + description: | + 指定された値と異なることを要求します。 + value に "" を指定することで、入力を必須とすることができます。 + properties: + _type: + type: string + example: "NotEquals" + value: + type: string + AdditionalDataRestrictionConditionMatches: + type: object + description: 指定された正規表現に合致することを要求します。 + properties: + _type: + type: string + example: "Matches" + value: + type: string + AdditionalDataRestrictionConditionNotMatches: + type: object + description: 指定された正規表現に合致しないことを要求します。 + properties: + _type: + type: string + example: "NotMatches" + value: + type: string + AdditionalDataRestrictionConditionHasLabel: + type: object + description: リンク属性において、リンク先として指定可能なラベルIDを制限します。 + properties: + _type: + type: string + example: "HasLabel" + values: + type: string + AdditionalDataRestrictionConditionImply: + type: object + description: | + premise で指定された条件を満たすとき、condition で指定された条件を満たすことを要求します。 + properties: + premise: + $ref: "#/components/schemas/AdditionalDataRestriction" + condition: + $ref: "#/components/schemas/AdditionalDataRestrictionCondition" Keybind: type: object properties: @@ -2738,7 +3002,7 @@ components: account_id: allOf: - $ref: "#/components/schemas/AccountId" - - description: 変更後の担当者のアカウントID + description: 変更後の担当者のアカウントID TaskStart: type: object properties: @@ -2746,6 +3010,50 @@ components: allOf: - $ref: "#/components/schemas/TaskPhase" - description: 開始するタスクのフェーズ + TaskAssignRequest: + type: object + required: + - request_type + properties: + request_type: + description: | + * `TaskAssignRequestTypeRandom`: タスクフェーズのみを指定してランダムにタスクを自身に割当します。プロジェクト設定でタスクのランダム割当を有効にした場合のみ利用できます。 + * `TaskAssignRequestTypeSelection`: 担当者とタスクを明示的に指定してタスクを割当します。プロジェクトオーナーもしくはチェッカーのみ、自身以外のプロジェクトメンバーを担当者に指定できます。プロジェクト設定でタスクの選択割当を有効にした場合のみ利用できます。 + oneOf: + - $ref: "#/components/schemas/TaskAssignRequestTypeRandom" + - $ref: "#/components/schemas/TaskAssignRequestTypeSelection" + TaskAssignRequestTypeRandom: + type: object + required: + - phase + properties: + phase: + description: 割当するタスクフェーズ + allOf: + - $ref: "#/components/schemas/TaskPhase" + _type: + type: string + description: Random + example: "Random" + TaskAssignRequestTypeSelection: + type: object + required: + - user_id + - task_ids + properties: + user_id: + description: タスクを誰に割当するか + allOf: + - $ref: "#/components/schemas/UserId" + task_ids: + description: 割当するタスクのID + type: array + items: + $ref: "#/components/schemas/TaskId" + _type: + type: string + description: Selection + example: "Selection" TaskHistoryShort: description: タスクのあるフェーズを誰が担当したかを表します。 type: object diff --git a/generate/swagger/swagger.yaml b/generate/swagger/swagger.yaml index 08c61005..a9adea63 100644 --- a/generate/swagger/swagger.yaml +++ b/generate/swagger/swagger.yaml @@ -76,7 +76,7 @@ info: WebhookID | プロジェクト内で一意 入力データセットID | 組織内で一意 - version: 0.68.1 + version: 0.69.1 title: AnnoFab Web API x-logo: url: "https://annofab.com/images/logo_landscape.png" @@ -2437,13 +2437,24 @@ paths: schema: type: string example: "123456789" + - name: v + in: query + description: | + 取得するアノテーション仕様のフォーマットバージョンを指定します。 + required: false + schema: + type: string + default: "1" + example: "2" responses: 200: description: 正常 content: application/json: schema: - $ref: "#/components/schemas/AnnotationSpecs" + oneOf: + - $ref: "#/components/schemas/AnnotationSpecsV1" + - $ref: "#/components/schemas/AnnotationSpecsV2" 401: $ref: "#/components/responses/ErrorUnauthorizedApi" 404: @@ -2470,14 +2481,16 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/AnnotationSpecsRequest" + oneOf: + - $ref: "#/components/schemas/AnnotationSpecsRequestV2" + - $ref: "#/components/schemas/AnnotationSpecsRequestV1" responses: 200: description: 正常 content: application/json: schema: - $ref: "#/components/schemas/AnnotationSpecs" + $ref: "#/components/schemas/AnnotationSpecsV2" 400: $ref: "#/components/responses/ErrorInvalidRequest" 401: @@ -2519,6 +2532,7 @@ paths: $ref: "#/components/responses/ErrorUnderMaintenance" /projects/{project_id}/start-task: post: + deprecated: true tags: - af-task summary: タスク割当 @@ -3039,6 +3053,54 @@ paths: $ref: "#/components/responses/ErrorMissingResource" 503: $ref: "#/components/responses/ErrorUnderMaintenance" + /projects/{project_id}/assign-tasks: + post: + tags: + - af-task + summary: タスク割当 + description: | + メンバーもしくは自身にタスクを割当します。 + + 個々のタスクの情報を取得する場合は、[タスク取得](#operation/getTask)を使います。 + security: + - AllProjectMember: [] + operationId: assignTasks + parameters: + - name: project_id + in: path + description: プロジェクトID + required: true + schema: + $ref: "#/components/schemas/ProjectId" + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/TaskAssignRequest" + responses: + 200: + description: 正常。割当したタスクを返します。 + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Task" + 400: + $ref: "#/components/responses/ErrorInvalidRequest" + 401: + $ref: "#/components/responses/ErrorUnauthorizedApi" + 404: + $ref: "#/components/responses/ErrorMissingResource" + 409: + description: プロジェクトが停止中のため、タスクの割当ができない。 + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorStateMismatch" + 503: + $ref: "#/components/responses/ErrorUnderMaintenance" /projects/{project_id}/tasks/{task_id}/operate: post: tags: @@ -3336,6 +3398,8 @@ paths: 更新対象のアノテーションのラベルを変更する場合、変更後のラベルに含まれない属性は削除されます。 + また、画像全体アノテーションのラベルは変更することができません。 + 複数の操作のうち、1つでも失敗するとAPIのレスポンス全体としては失敗になります。 成功した部分までは反映されます。 受入が完了しているタスクのアノテーション更新を含む場合、オーナー以上の権限が必要になります。 @@ -3631,55 +3695,6 @@ paths: $ref: "#/components/responses/ErrorUnauthorizedApi" 503: $ref: "#/components/responses/ErrorUnderMaintenance" - /projects/{project_id}/tasks/{task_id}/inputs/{input_data_id}/annotation/{annotation_id}/outer: - get: - deprecated: true - operationId: getOuterWithProIdTasIdInpDatIdAnnId - tags: - - af-annotation - summary: 【エディタ用】外部ファイル形式のアノテーション取得 - description: | - このAPIが返すアノテーションは、エディタ用です。 - 機械学習などで利用する成果物としてのアノテーションを取得するには、以下をご利用いただけます。 - - * [getAnnotation](#operation/getAnnotation): 特定のタスク - 入力データのアノテーション取得 - * [getAnnotationArchive](#operation/getAnnotationArchive): プロジェクト全体のアノテーション(ZIP) - security: - - AllProjectMember: [] - parameters: - - name: project_id - in: path - description: プロジェクトID - required: true - schema: - $ref: "#/components/schemas/ProjectId" - - name: task_id - in: path - description: タスクID - required: true - schema: - $ref: "#/components/schemas/TaskId" - - name: input_data_id - in: path - description: 入力データID - required: true - schema: - $ref: "#/components/schemas/InputDataId" - - name: annotation_id - in: path - description: アノテーションID - required: true - schema: - $ref: "#/components/schemas/AnnotationId" - responses: - 200: - description: 正常(エディタ用の外部保存形式のアノテーション実体。PNG画像など) - 401: - $ref: "#/components/responses/ErrorUnauthorizedApi" - 404: - $ref: "#/components/responses/ErrorMissingResource" - 503: - $ref: "#/components/responses/ErrorUnderMaintenance" /projects/{project_id}/tasks/{task_id}/inputs/{input_data_id}/inspections: get: tags: @@ -5463,6 +5478,12 @@ components: TaskHistoryId: type: string example: "12345678-abcd-1234-abcd-1234abcd5678" + TaskAssignmentType: + type: string + enum: + - random + - selection + - random_and_selection AnnotationId: type: string example: "12345678-abcd-1234-abcd-1234abcd5678" @@ -5582,6 +5603,10 @@ components: description: 再提出されたタスクの検査/受入担当者ルール。 $ref: "#/components/schemas/AssigneeRuleOfResubmittedTask" default: no_assignee + task_assignment_type: + description: タスクの割当方式。 + $ref: "#/components/schemas/TaskAssignmentType" + default: random max_tasks_per_member: description: 保留中のタスクを除き、1人(オーナー以外)に割り当てられるタスク数上限。未指定の場合は10件として扱う。 type: integer @@ -5629,6 +5654,16 @@ components: last_tasks_updated_datetime: type: string format: date-time + TaskAssginmentType: + type: string + enum: + - random + - selection + - random_and_selection + description: | + * `random` - タスクフェーズのみを指定してランダムにタスクを自身に割当する方式です。 + * `selection` - 担当者とタスクを明示的に指定してタスクを割当する方式です。プロジェクトオーナーもしくはチェッカーのみ、自身以外のプロジェクトメンバーを担当者に指定できます。 + * `random_and_selection` - ランダム割当と選択割当の両機能を使用する方式です。 JobInfo: type: object properties: @@ -6213,7 +6248,20 @@ components: $ref: "#/components/schemas/Marker" last_updated_datetime: $ref: "#/components/schemas/LastUpdatedDatetime" - AnnotationSpecs: + AnnotationSpecsV1: + type: object + properties: + project_id: + $ref: "#/components/schemas/ProjectId" + labels: + type: array + items: + $ref: "#/components/schemas/LabelV1" + inspection_phrases: + type: array + items: + $ref: "#/components/schemas/InspectionPhrase" + AnnotationSpecsV2: type: object properties: project_id: @@ -6221,26 +6269,58 @@ components: labels: type: array items: - $ref: "#/components/schemas/Label" + $ref: "#/components/schemas/LabelV2" + additionals: + type: array + items: + $ref: "#/components/schemas/AdditionalDataDefinitionV2" + restrictions: + type: array + items: + $ref: "#/components/schemas/AdditionalDataRestriction" inspection_phrases: type: array items: $ref: "#/components/schemas/InspectionPhrase" - AnnotationSpecsRequest: + AnnotationSpecsRequestV1: type: object properties: labels: type: array items: - $ref: "#/components/schemas/Label" - description: | - ラベル + $ref: "#/components/schemas/LabelV1" inspection_phrases: type: array items: $ref: "#/components/schemas/InspectionPhrase" + comment: + type: string + autoMarking: + type: boolean + default: false description: | - 定型指摘 + trueが指定された場合、各統計グラフにマーカーを自動追加します。 + マーカーのタイトルには `comment` に指定された文字列が設定されます。 + `comment` が指定されていなかった場合は "アノテーション仕様の変更" という文字列が設定されます。 + AnnotationSpecsRequestV2: + type: object + properties: + labels: + type: array + items: + $ref: "#/components/schemas/LabelV2" + additionals: + type: array + items: + $ref: "#/components/schemas/AdditionalDataDefinitionV2" + restrictions: + type: array + items: + $ref: "#/components/schemas/AdditionalDataRestriction" + inspection_phrases: + type: array + items: + $ref: "#/components/schemas/InspectionPhrase" comment: type: string autoMarking: @@ -6313,7 +6393,7 @@ components: * `select` - 選択肢(ドロップダウン式) * `tracking` - 自由記述 (トラッキングID自動挿入) * `link` - アノテーションリンク - Label: + LabelV1: type: object properties: label_id: @@ -6361,7 +6441,63 @@ components: additional_data_definitions: type: array items: - $ref: "#/components/schemas/AdditionalDataDefinition" + $ref: "#/components/schemas/AdditionalDataDefinitionV1" + color: + $ref: "#/components/schemas/Color" + annotation_editor_feature: + $ref: "#/components/schemas/AnnotationEditorFeature" + allow_out_of_image_bounds: + type: boolean + default: false + LabelV2: + type: object + properties: + label_id: + $ref: "#/components/schemas/LabelId" + label_name: + $ref: "#/components/schemas/InternationalizationMessage" + keybind: + type: array + items: + $ref: "#/components/schemas/Keybind" + annotation_type: + $ref: "#/components/schemas/AnnotationType" + bounding_box_metadata: + type: object + properties: + min_width: + type: integer + min_height: + type: integer + min_warn_rule: + type: string + default: or + min_area: + type: integer + minimum: 1 + maximum: 1000000 + max_vertices: + type: integer + min_vertices: + type: integer + tolerance: + type: integer + segmentation_metadata: + type: object + properties: + min_width: + type: integer + min_height: + type: integer + min_warn_rule: + type: string + default: or + tolerance: + type: integer + additional_data_definitions: + type: array + items: + $ref: "#/components/schemas/AdditionalDataDefinitionId" color: $ref: "#/components/schemas/Color" annotation_editor_feature: @@ -6399,7 +6535,7 @@ components: type: boolean fill_near: type: boolean - AdditionalDataDefinition: + AdditionalDataDefinitionV1: type: object properties: additional_data_definition_id: @@ -6458,6 +6594,138 @@ components: required: type: boolean description: リンク属性において、入力を必須とするかどうか + AdditionalDataDefinitionV2: + type: object + properties: + additional_data_definition_id: + $ref: "#/components/schemas/AdditionalDataDefinitionId" + read_only: + type: boolean + default: false + name: + $ref: "#/components/schemas/InternationalizationMessage" + default: + oneOf: + - type: boolean + - type: integer + - type: string + description: | + 属性の初期値です。 + + 初期値を指定する場合、属性の種類に応じて次の値を指定します。初期値を設定しない場合には空文字を指定します。 + + * type が flag の場合: 真偽値(`true` or `false`) + * type が integer の場合: 整数値 + * type が text の場合: 文字列 + * type が comment の場合: 文字列 + * type が choice の場合: 選択肢(`choices`)の `choice_id` + * type が select の場合: 選択肢(`choices`)の `choice_id` + + 属性の種類に対して有効でない初期値を設定した場合、その設定は無視されます。 + + なお、トラッキングとリンクには初期値を設定できません。 + keybind: + type: array + items: + $ref: "#/components/schemas/Keybind" + type: + $ref: "#/components/schemas/AdditionalDataDefinitionType" + choices: + type: array + items: + type: object + properties: + choice_id: + $ref: "#/components/schemas/ChoiceId" + name: + $ref: "#/components/schemas/InternationalizationMessage" + keybind: + type: array + items: + $ref: "#/components/schemas/Keybind" + AdditionalDataRestriction: + type: object + properties: + additional_data_definition_id: + $ref: "#/components/schemas/AdditionalDataDefinitionId" + condition: + $ref: "#/components/schemas/AdditionalDataRestrictionCondition" + AdditionalDataRestrictionCondition: + oneOf: + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionCanInput" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionEquals" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionNotEquals" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionMatches" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionNotMatches" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionHasLabel" + - $ref: "#/components/schemas/AdditionalDataRestrictionConditionImply" + AdditionalDataRestrictionConditionCanInput: + type: object + description: | + enable=false とすることで、入力を許可しないようにできます。 + Imply との組み合わせで、特定条件下のみ入力を許すといった制限ができます。 + properties: + _type: + type: string + example: "CanInput" + enable: + type: boolean + AdditionalDataRestrictionConditionEquals: + type: object + description: 指定された値と等しいことを要求します。 + properties: + _type: + type: string + example: "Equals" + value: + type: string + AdditionalDataRestrictionConditionNotEquals: + type: object + description: | + 指定された値と異なることを要求します。 + value に "" を指定することで、入力を必須とすることができます。 + properties: + _type: + type: string + example: "NotEquals" + value: + type: string + AdditionalDataRestrictionConditionMatches: + type: object + description: 指定された正規表現に合致することを要求します。 + properties: + _type: + type: string + example: "Matches" + value: + type: string + AdditionalDataRestrictionConditionNotMatches: + type: object + description: 指定された正規表現に合致しないことを要求します。 + properties: + _type: + type: string + example: "NotMatches" + value: + type: string + AdditionalDataRestrictionConditionHasLabel: + type: object + description: リンク属性において、リンク先として指定可能なラベルIDを制限します。 + properties: + _type: + type: string + example: "HasLabel" + values: + type: string + AdditionalDataRestrictionConditionImply: + type: object + description: | + premise で指定された条件を満たすとき、condition で指定された条件を満たすことを要求します。 + properties: + premise: + $ref: "#/components/schemas/AdditionalDataRestriction" + condition: + $ref: "#/components/schemas/AdditionalDataRestrictionCondition" Keybind: type: object properties: @@ -6670,7 +6938,7 @@ components: account_id: allOf: - $ref: "#/components/schemas/AccountId" - - description: 変更後の担当者のアカウントID + description: 変更後の担当者のアカウントID TaskStart: type: object properties: @@ -6678,6 +6946,50 @@ components: allOf: - $ref: "#/components/schemas/TaskPhase" - description: 開始するタスクのフェーズ + TaskAssignRequest: + type: object + required: + - request_type + properties: + request_type: + description: | + * `TaskAssignRequestTypeRandom`: タスクフェーズのみを指定してランダムにタスクを自身に割当します。プロジェクト設定でタスクのランダム割当を有効にした場合のみ利用できます。 + * `TaskAssignRequestTypeSelection`: 担当者とタスクを明示的に指定してタスクを割当します。プロジェクトオーナーもしくはチェッカーのみ、自身以外のプロジェクトメンバーを担当者に指定できます。プロジェクト設定でタスクの選択割当を有効にした場合のみ利用できます。 + oneOf: + - $ref: "#/components/schemas/TaskAssignRequestTypeRandom" + - $ref: "#/components/schemas/TaskAssignRequestTypeSelection" + TaskAssignRequestTypeRandom: + type: object + required: + - phase + properties: + phase: + description: 割当するタスクフェーズ + allOf: + - $ref: "#/components/schemas/TaskPhase" + _type: + type: string + description: Random + example: "Random" + TaskAssignRequestTypeSelection: + type: object + required: + - user_id + - task_ids + properties: + user_id: + description: タスクを誰に割当するか + allOf: + - $ref: "#/components/schemas/UserId" + task_ids: + description: 割当するタスクのID + type: array + items: + $ref: "#/components/schemas/TaskId" + _type: + type: string + description: Selection + example: "Selection" TaskHistoryShort: description: タスクのあるフェーズを誰が担当したかを表します。 type: object diff --git a/tests/data/dataclass/annotation-specs.json b/tests/data/dataclass/annotation-specs-v1.json similarity index 100% rename from tests/data/dataclass/annotation-specs.json rename to tests/data/dataclass/annotation-specs-v1.json diff --git a/tests/data/dataclass/project.json b/tests/data/dataclass/project.json index c716d4f5..6db3287f 100644 --- a/tests/data/dataclass/project.json +++ b/tests/data/dataclass/project.json @@ -10,6 +10,7 @@ "configuration": { "number_of_inspections": 0, "assignee_rule_of_resubmitted_task": "no_assignee", + "task_assignment_type": "random_and_selection", "max_tasks_per_member": 10, "max_tasks_per_member_including_hold": 20, "private_storage_aws_iam_role_arn": null, diff --git a/tests/test_api.py b/tests/test_api.py index 48362e55..13633197 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -104,9 +104,6 @@ def test_annotation(): print("wrapper.download_annotation_archive") wrapper.download_annotation_archive(project_id, f'{out_dir}/simple-annotation.zip') - print("wrapper.download_full_annotation_archive") - wrapper.download_full_annotation_archive(project_id, f'{out_dir}/full-annotation.zip') - if should_execute_job_api: print("post_annotation_archive_update") assert type(api.post_annotation_archive_update(project_id)[0]) == dict @@ -126,10 +123,6 @@ def test_annotation_specs(): puted_annotation_spec, _ = api.put_annotation_specs(project_id, request_body=request_body) assert type(puted_annotation_spec) == dict - print("wrapper.copy_annotation_specs") - content = wrapper.copy_annotation_specs(src_project_id=project_id, dest_project_id=project_id) - assert type(content) == dict - print("get_annotation_specs_histories") annotation_specs_histories = api.get_annotation_specs_histories(project_id)[0] assert type(annotation_specs_histories) == list @@ -335,57 +328,58 @@ def test_graph_marker(self): assert type(api.put_markers(project_id, request_body=request_body)[0]) == dict -def test_task(): - test_task_id = str(uuid.uuid4()) - - print(f"put_task. test_task_id={test_task_id}") - first_input_data = test_wrapper.get_first_input_data(project_id) - input_data_id_list = [first_input_data['input_data_id']] - request_body = {"input_data_id_list": input_data_id_list} - test_task_data = api.put_task(project_id, test_task_id, request_body=request_body)[0] - assert type(test_task_data) == dict - - print(f"get_task") - assert type(api.get_task(project_id, test_task_id)[0]) == dict - - print(f"get_tasks in wrapper.get_all_tasks") - time.sleep(3) # sleepしないと失敗したため - assert len(wrapper.get_all_tasks(project_id, query_params={'task_id': test_task_id})) == 1 - - print(f"start_task (annotation)") - request_body = {"phase": "annotation"} - assert type(api.start_task(project_id, request_body=request_body)[0]) == dict - - print(f"operate_task") - request_body1 = { - 'status': 'not_started', - 'last_updated_datetime': test_task_data['updated_datetime'], - 'account_id': my_account_id - } - assert type(api.operate_task(project_id, test_task_id, request_body=request_body1)[0]) == dict - - print(f"get_task_histories") - assert len(api.get_task_histories(project_id, test_task_id)[0]) > 0 - - print(f"delete_task") - assert type(api.delete_task(project_id, test_task_id)[0]) == dict - - test2_task_id = str(uuid.uuid4()) - print(f"batch_update_tasks. test_task_id={test2_task_id}") - request_body = {"input_data_id_list": input_data_id_list} - test_task_data = api.put_task(project_id, test2_task_id, request_body=request_body)[0] - - request_body = [{'project_id': project_id, 'task_id': test2_task_id, '_type': 'Delete'}] - content = api.batch_update_tasks(project_id, request_body=request_body)[0] - assert type(content) == list - - if should_execute_job_api: - print(f"initiate_tasks_generation in wrapper.initiate_tasks_generation_by_csv") - csv_file_path = f'{test_dir}/tmp/create_task.csv' - create_csv_for_task(csv_file_path, first_input_data) - task_id_prefix = str(uuid.uuid4()) - content = wrapper.initiate_tasks_generation_by_csv(project_id, csv_file_path, task_id_prefix) - assert type(content) == dict +class TestTask: + def test_task(self): + test_task_id = str(uuid.uuid4()) + + print(f"put_task. test_task_id={test_task_id}") + first_input_data = test_wrapper.get_first_input_data(project_id) + input_data_id_list = [first_input_data['input_data_id']] + request_body = {"input_data_id_list": input_data_id_list} + test_task_data = api.put_task(project_id, test_task_id, request_body=request_body)[0] + assert type(test_task_data) == dict + + print(f"get_task") + assert type(api.get_task(project_id, test_task_id)[0]) == dict + + print(f"get_tasks in wrapper.get_all_tasks") + time.sleep(3) # sleepしないと失敗したため + assert len(wrapper.get_all_tasks(project_id, query_params={'task_id': test_task_id})) == 1 + + print(f"assign_tasks") + request_body = {"request_type": {"task_ids": [test_task_id], "user_id": annofab_user_id, "_type": "Selection"}} + assert type(api.assign_tasks(project_id, request_body=request_body)[0]) == list + + print(f"operate_task") + request_body1 = { + 'status': 'not_started', + 'last_updated_datetime': test_task_data['updated_datetime'], + 'account_id': my_account_id + } + assert type(api.operate_task(project_id, test_task_id, request_body=request_body1)[0]) == dict + + print(f"get_task_histories") + assert len(api.get_task_histories(project_id, test_task_id)[0]) > 0 + + print(f"delete_task") + assert type(api.delete_task(project_id, test_task_id)[0]) == dict + + test2_task_id = str(uuid.uuid4()) + print(f"batch_update_tasks. test_task_id={test2_task_id}") + request_body = {"input_data_id_list": input_data_id_list} + test_task_data = api.put_task(project_id, test2_task_id, request_body=request_body)[0] + + request_body = [{'project_id': project_id, 'task_id': test2_task_id, '_type': 'Delete'}] + content = api.batch_update_tasks(project_id, request_body=request_body)[0] + assert type(content) == list + + if should_execute_job_api: + print(f"initiate_tasks_generation in wrapper.initiate_tasks_generation_by_csv") + csv_file_path = f'{test_dir}/tmp/create_task.csv' + create_csv_for_task(csv_file_path, first_input_data) + task_id_prefix = str(uuid.uuid4()) + content = wrapper.initiate_tasks_generation_by_csv(project_id, csv_file_path, task_id_prefix) + assert type(content) == dict def test_instruction(): diff --git a/tests/test_dataclass.py b/tests/test_dataclass.py index e98b4dc3..18bfdf81 100644 --- a/tests/test_dataclass.py +++ b/tests/test_dataclass.py @@ -6,7 +6,7 @@ import annofabapi import annofabapi.utils from annofabapi.dataclass.annotation import SimpleAnnotation, SingleAnnotation -from annofabapi.dataclass.annotation_specs import AnnotationSpecs +from annofabapi.dataclass.annotation_specs import AnnotationSpecsV1 from annofabapi.dataclass.input import InputData from annofabapi.dataclass.inspection import Inspection from annofabapi.dataclass.instruction import Instruction, InstructionHistory, InstructionImage @@ -60,11 +60,11 @@ def test_full_annotation(self): assert type(simple_annotation) == SimpleAnnotation -class TestAnnotationSpecs: +class TestAnnotationSpecsV1: def test_annotation_specs(self): dict_annotation_specs, _ = service.api.get_annotation_specs(project_id) - annotation_specs = AnnotationSpecs.from_dict(dict_annotation_specs) - assert type(annotation_specs) == AnnotationSpecs + annotation_specs = AnnotationSpecsV1.from_dict(dict_annotation_specs) + assert type(annotation_specs) == AnnotationSpecsV1 class TestInput: diff --git a/tests/test_local_dataclass.py b/tests/test_local_dataclass.py index eaff3d1b..e210dd96 100644 --- a/tests/test_local_dataclass.py +++ b/tests/test_local_dataclass.py @@ -4,7 +4,7 @@ from pathlib import Path from annofabapi.dataclass.annotation import FullAnnotation, SimpleAnnotation -from annofabapi.dataclass.annotation_specs import AnnotationSpecs +from annofabapi.dataclass.annotation_specs import AnnotationSpecsV1 from annofabapi.dataclass.input import InputData from annofabapi.dataclass.inspection import Inspection from annofabapi.dataclass.instruction import Instruction, InstructionHistory, InstructionImage @@ -51,13 +51,13 @@ def test_full_annotation(self): assert type(full_annotion) == FullAnnotation -class TestAnnotationSpecs: +class TestAnnotationSpecsV1: def test_annotation_specs(self): - annotaion_specs_json = test_dir / "annotation-specs.json" + annotaion_specs_json = test_dir / "annotation-specs-v1.json" with annotaion_specs_json.open(encoding="utf-8") as f: dict_annotation_specs = json.load(f) - annotation_specs = AnnotationSpecs.from_dict(dict_annotation_specs) - assert type(annotation_specs) == AnnotationSpecs + annotation_specs = AnnotationSpecsV1.from_dict(dict_annotation_specs) + assert type(annotation_specs) == AnnotationSpecsV1 class TestInput: