decidim-restfull-core 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/app/commands/decidim/rest_full/core/create_api_client.rb +40 -0
- data/app/commands/decidim/rest_full/core/impersonate_resource_owner_from_credentials.rb +151 -0
- data/app/commands/decidim/rest_full/core/syncronize_unconfirmed_host.rb +45 -0
- data/app/controllers/concerns/decidim/api/rest_full/async_api_job_enqueuing.rb +69 -0
- data/app/controllers/concerns/decidim/api/rest_full/collection_pagination.rb +78 -0
- data/app/controllers/concerns/decidim/api/rest_full/collection_pagination_meta.rb +25 -0
- data/app/controllers/concerns/decidim/api/rest_full/conditional_get_rendering.rb +49 -0
- data/app/controllers/concerns/decidim/api/rest_full/extended_data_endpoints.rb +96 -0
- data/app/controllers/concerns/decidim/api/rest_full/job_response_linking.rb +31 -0
- data/app/controllers/decidim/api/rest_full/application_controller.rb +245 -0
- data/app/controllers/decidim/api/rest_full/attachments/attachments_controller.rb +81 -0
- data/app/controllers/decidim/api/rest_full/components/component_extended_data_controller.rb +31 -0
- data/app/controllers/decidim/api/rest_full/components/components_controller.rb +68 -0
- data/app/controllers/decidim/api/rest_full/core/resources_controller.rb +142 -0
- data/app/controllers/decidim/api/rest_full/core.rb +11 -0
- data/app/controllers/decidim/api/rest_full/jobs/jobs_controller.rb +109 -0
- data/app/controllers/decidim/api/rest_full/organizations/organization_extended_data_controller.rb +31 -0
- data/app/controllers/decidim/api/rest_full/organizations/organizations_controller.rb +234 -0
- data/app/controllers/decidim/api/rest_full/roles/roles_controller.rb +125 -0
- data/app/controllers/decidim/api/rest_full/spaces/space_extended_data_controller.rb +29 -0
- data/app/controllers/decidim/api/rest_full/spaces/spaces_controller.rb +225 -0
- data/app/controllers/decidim/api/rest_full/users/magic_links_controller.rb +81 -0
- data/app/controllers/decidim/api/rest_full/users/user_extended_data_controller.rb +92 -0
- data/app/controllers/decidim/api/rest_full/users/users_controller.rb +40 -0
- data/app/controllers/decidim/api/rest_full/webhooks/webhook_events_controller.rb +33 -0
- data/app/controllers/decidim/api/rest_full/webhooks/webhook_registrations_controller.rb +106 -0
- data/app/controllers/decidim/rest_full/pages_controller.rb +9 -0
- data/app/controllers/decidim/rest_full/system/api_clients_controller.rb +69 -0
- data/app/controllers/decidim/rest_full/system/permissions_controller.rb +30 -0
- data/app/controllers/decidim/rest_full/system/webhook_registrations_controller.rb +49 -0
- data/app/forms/decidim/rest_full/core/admin/config_form.rb +49 -0
- data/app/forms/decidim/rest_full/core/api_client_form.rb +20 -0
- data/app/forms/decidim/rest_full/core/api_permissions.rb +18 -0
- data/app/forms/decidim/rest_full/core/magic_link_redirect_url_form.rb +114 -0
- data/app/forms/decidim/rest_full/core/webhook_event_form.rb +35 -0
- data/app/forms/decidim/rest_full/core/webhook_registration_form.rb +49 -0
- data/app/jobs/decidim/rest_full/application_job.rb +10 -0
- data/app/jobs/decidim/rest_full/core/space_webhook_job.rb +60 -0
- data/app/jobs/decidim/rest_full/core/syncronize_unconfirmed_host_job.rb +18 -0
- data/app/jobs/decidim/rest_full/core/webhook_job.rb +13 -0
- data/app/jobs/decidim/rest_full/execute_api_job_job.rb +55 -0
- data/app/models/decidim/rest_full/api_job.rb +74 -0
- data/app/models/decidim/rest_full/core/ability.rb +195 -0
- data/app/models/decidim/rest_full/core/api_client.rb +56 -0
- data/app/models/decidim/rest_full/core/magic_token.rb +45 -0
- data/app/models/decidim/rest_full/core/permission.rb +15 -0
- data/app/models/decidim/rest_full/core/resource_extended_data.rb +16 -0
- data/app/models/decidim/rest_full/core/webhook_registration.rb +61 -0
- data/app/overrides/system_host_input.rb +40 -0
- data/app/serializers/decidim/api/rest_full/core/application_serializer.rb +19 -0
- data/app/serializers/decidim/api/rest_full/core/assembly_serializer.rb +13 -0
- data/app/serializers/decidim/api/rest_full/core/attachment_serializer.rb +76 -0
- data/app/serializers/decidim/api/rest_full/core/awesome_iframe_component_serializer.rb +12 -0
- data/app/serializers/decidim/api/rest_full/core/awesome_map_component_serializer.rb +12 -0
- data/app/serializers/decidim/api/rest_full/core/component_serializer.rb +97 -0
- data/app/serializers/decidim/api/rest_full/core/helpers/resource_links_helper.rb +48 -0
- data/app/serializers/decidim/api/rest_full/core/magic_link_redirect_serializer.rb +43 -0
- data/app/serializers/decidim/api/rest_full/core/magic_link_serializer.rb +44 -0
- data/app/serializers/decidim/api/rest_full/core/organization_serializer.rb +60 -0
- data/app/serializers/decidim/api/rest_full/core/organization_webhook_serializer.rb +21 -0
- data/app/serializers/decidim/api/rest_full/core/page_component_serializer.rb +20 -0
- data/app/serializers/decidim/api/rest_full/core/page_serializer.rb +12 -0
- data/app/serializers/decidim/api/rest_full/core/participatory_process_serializer.rb +13 -0
- data/app/serializers/decidim/api/rest_full/core/resource_serializer.rb +84 -0
- data/app/serializers/decidim/api/rest_full/core/role_serializer.rb +21 -0
- data/app/serializers/decidim/api/rest_full/core/serializer_lookup.rb +55 -0
- data/app/serializers/decidim/api/rest_full/core/space_serializer.rb +117 -0
- data/app/serializers/decidim/api/rest_full/core/space_webhook_serializer.rb +64 -0
- data/app/serializers/decidim/api/rest_full/core/user_serializer.rb +43 -0
- data/app/serializers/decidim/api/rest_full/core/user_webhook_serializer.rb +21 -0
- data/app/serializers/decidim/api/rest_full/core/webhook_registration_serializer.rb +25 -0
- data/app/serializers/decidim/api/rest_full/core/webhook_serializer.rb +68 -0
- data/app/serializers/decidim/api/rest_full/core.rb +10 -0
- data/app/services/decidim/rest_full/core/api_system_operations.rb +505 -0
- data/app/services/decidim/rest_full/core/fire_webhook.rb +114 -0
- data/app/services/decidim/rest_full/core/participatory_process_step_activated_webhook_handler.rb +39 -0
- data/app/services/decidim/rest_full/participatory_space_visibility.rb +64 -0
- data/app/views/decidim/rest_full/core/admin/_organization_settings_tab.html.erb +35 -0
- data/app/views/decidim/rest_full/pages/show.html.erb +60 -0
- data/app/views/decidim/rest_full/system/api_clients/_edit_info_tab.erb +261 -0
- data/app/views/decidim/rest_full/system/api_clients/_edit_webhook_tab.erb +74 -0
- data/app/views/decidim/rest_full/system/api_clients/_form.html.erb +23 -0
- data/app/views/decidim/rest_full/system/api_clients/_permissions_scope.html.erb +22 -0
- data/app/views/decidim/rest_full/system/api_clients/edit.html.erb +53 -0
- data/app/views/decidim/rest_full/system/api_clients/index.html.erb +37 -0
- data/app/views/decidim/rest_full/system/api_clients/new.html.erb +13 -0
- data/app/views/decidim/rest_full/system/api_clients/show.html.erb +10 -0
- data/config/i18n-tasks.yml +381 -0
- data/config/locales/decidim_rest_full.en.yml +184 -0
- data/config/routes.rb +116 -0
- data/db/migrate/20241125061513_create_api_client_permissions.rb +12 -0
- data/db/migrate/20250112155305_create_proposal_application_id.rb +11 -0
- data/db/migrate/20250131155931_add_users_magic_token.rb +14 -0
- data/db/migrate/20250609083335_create_webhooks_table.rb +16 -0
- data/db/migrate/20250609091039_add_is_event_to_api_client_permissions.rb +7 -0
- data/db/migrate/20250624080106_create_organization_extended_data.rb +11 -0
- data/db/migrate/20260321120000_add_redirect_url_to_decidim_rest_full_user_magic_tokens.rb +7 -0
- data/db/migrate/20260511120000_create_decidim_rest_full_api_jobs.rb +23 -0
- data/db/migrate/20260515120000_add_poll_and_oauth_context_to_rest_full_api_jobs.rb +38 -0
- data/db/migrate/20260516153000_remove_poll_secret_from_decidim_rest_full_api_jobs.rb +7 -0
- data/db/migrate/20260516160000_add_org_status_index_to_rest_full_api_jobs.rb +9 -0
- data/db/migrate/20260805070000_create_resource_extended_data.rb +44 -0
- data/lib/decidim/rest_full/api_execution_context.rb +58 -0
- data/lib/decidim/rest_full/api_job_command_runner.rb +48 -0
- data/lib/decidim/rest_full/api_job_payload.rb +19 -0
- data/lib/decidim/rest_full/cli/base.rb +84 -0
- data/lib/decidim/rest_full/cli/create.rb +122 -0
- data/lib/decidim/rest_full/cli/delete.rb +48 -0
- data/lib/decidim/rest_full/cli/get.rb +53 -0
- data/lib/decidim/rest_full/cli/grant.rb +58 -0
- data/lib/decidim/rest_full/cli/revoke.rb +53 -0
- data/lib/decidim/rest_full/cli.rb +70 -0
- data/lib/decidim/rest_full/core/apartment_tenant_switch.rb +23 -0
- data/lib/decidim/rest_full/core/api_exception.rb +179 -0
- data/lib/decidim/rest_full/core/attachments_operations.rb +232 -0
- data/lib/decidim/rest_full/core/configuration.rb +116 -0
- data/lib/decidim/rest_full/core/definition_registry.rb +509 -0
- data/lib/decidim/rest_full/core/doorkeeper_config.rb +130 -0
- data/lib/decidim/rest_full/core/engine.rb +167 -0
- data/lib/decidim/rest_full/core/extended_data_at_path.rb +22 -0
- data/lib/decidim/rest_full/core/gem_spec_paths.rb +56 -0
- data/lib/decidim/rest_full/core/has_extended_data.rb +70 -0
- data/lib/decidim/rest_full/core/http_cache/collection_fingerprint.rb +97 -0
- data/lib/decidim/rest_full/core/http_cache/fingerprint_contributor_registry.rb +53 -0
- data/lib/decidim/rest_full/core/http_cache/request_oauth_context.rb +34 -0
- data/lib/decidim/rest_full/core/http_cache/resource_show_fingerprint.rb +74 -0
- data/lib/decidim/rest_full/core/menu.rb +18 -0
- data/lib/decidim/rest_full/core/module_availability.rb +181 -0
- data/lib/decidim/rest_full/core/open_api_definition_paths.rb +59 -0
- data/lib/decidim/rest_full/core/overrides/application_mailer_override.rb +50 -0
- data/lib/decidim/rest_full/core/overrides/organization_client_ids_override.rb +17 -0
- data/lib/decidim/rest_full/core/overrides/update_organization_command_override.rb +27 -0
- data/lib/decidim/rest_full/core/overrides/update_organization_form_override.rb +46 -0
- data/lib/decidim/rest_full/core/overrides/user_extended_data_ransack.rb +15 -0
- data/lib/decidim/rest_full/core/overrides/user_magic_token_override.rb +27 -0
- data/lib/decidim/rest_full/core/permission_registry.rb +65 -0
- data/lib/decidim/rest_full/core/ransackers.rb +99 -0
- data/lib/decidim/rest_full/core/rest_enhancement_builder.rb +115 -0
- data/lib/decidim/rest_full/core/rest_enhancement_registration.rb +21 -0
- data/lib/decidim/rest_full/core/roles/role_id_codec.rb +50 -0
- data/lib/decidim/rest_full/core/roles/roles_aggregator.rb +203 -0
- data/lib/decidim/rest_full/core/roles/roles_writer.rb +343 -0
- data/lib/decidim/rest_full/core/route_registry.rb +123 -0
- data/lib/decidim/rest_full/core/serializer_additions_registry.rb +100 -0
- data/lib/decidim/rest_full/core/settings_tab.rb +22 -0
- data/lib/decidim/rest_full/core/swagger_spec_paths.rb +61 -0
- data/lib/decidim/rest_full/core/tokens_availability.rb +23 -0
- data/lib/decidim/rest_full/core/webhook_dispatcher.rb +55 -0
- data/lib/decidim/rest_full/core/webhook_event_catalog.rb +136 -0
- data/lib/decidim/rest_full/extension.rb +276 -0
- data/lib/decidim/rest_full/rest_full.rb +12 -0
- data/lib/decidim/rest_full/routes.rb +58 -0
- data/lib/decidim/rest_full/routing.rb +53 -0
- data/lib/decidim/rest_full/sync_runner.rb +14 -0
- data/lib/decidim/rest_full/test/apartment.rb +52 -0
- data/lib/decidim/rest_full/test/definitions/README.md +96 -0
- data/lib/decidim/rest_full/test/definitions/attachment.rb +64 -0
- data/lib/decidim/rest_full/test/definitions/collection_meta.rb +20 -0
- data/lib/decidim/rest_full/test/definitions/component.rb +99 -0
- data/lib/decidim/rest_full/test/definitions/component_type.rb +8 -0
- data/lib/decidim/rest_full/test/definitions/core.rb +16 -0
- data/lib/decidim/rest_full/test/definitions/creation_date.rb +11 -0
- data/lib/decidim/rest_full/test/definitions/edition_date.rb +11 -0
- data/lib/decidim/rest_full/test/definitions/error.rb +40 -0
- data/lib/decidim/rest_full/test/definitions/filter_param.rb +105 -0
- data/lib/decidim/rest_full/test/definitions/grant_param.rb +82 -0
- data/lib/decidim/rest_full/test/definitions/health.rb +12 -0
- data/lib/decidim/rest_full/test/definitions/introspect_data.rb +67 -0
- data/lib/decidim/rest_full/test/definitions/job.rb +130 -0
- data/lib/decidim/rest_full/test/definitions/locales_param.rb +19 -0
- data/lib/decidim/rest_full/test/definitions/magic_link.rb +37 -0
- data/lib/decidim/rest_full/test/definitions/magic_link_redirect.rb +32 -0
- data/lib/decidim/rest_full/test/definitions/manifests.rb +28 -0
- data/lib/decidim/rest_full/test/definitions/oauth_token_response.rb +18 -0
- data/lib/decidim/rest_full/test/definitions/organization.rb +75 -0
- data/lib/decidim/rest_full/test/definitions/organization_extended_data.rb +19 -0
- data/lib/decidim/rest_full/test/definitions/publication_date.rb +11 -0
- data/lib/decidim/rest_full/test/definitions/relationship_identifier.rb +29 -0
- data/lib/decidim/rest_full/test/definitions/resource_extended_data.rb +20 -0
- data/lib/decidim/rest_full/test/definitions/role.rb +61 -0
- data/lib/decidim/rest_full/test/definitions/shared.rb +22 -0
- data/lib/decidim/rest_full/test/definitions/space.rb +112 -0
- data/lib/decidim/rest_full/test/definitions/tags/attachments_tag.rb +26 -0
- data/lib/decidim/rest_full/test/definitions/tags/component_tag.rb +26 -0
- data/lib/decidim/rest_full/test/definitions/tags/jobs_tag.rb +20 -0
- data/lib/decidim/rest_full/test/definitions/tags/oauth_tag.rb +28 -0
- data/lib/decidim/rest_full/test/definitions/tags/organization_extended_data_tag.rb +22 -0
- data/lib/decidim/rest_full/test/definitions/tags/organizations_tag.rb +24 -0
- data/lib/decidim/rest_full/test/definitions/tags/roles_tag.rb +14 -0
- data/lib/decidim/rest_full/test/definitions/tags/space_tag.rb +22 -0
- data/lib/decidim/rest_full/test/definitions/tags/users_tag.rb +14 -0
- data/lib/decidim/rest_full/test/definitions/tags/webhooks_tag.rb +31 -0
- data/lib/decidim/rest_full/test/definitions/tags.rb +12 -0
- data/lib/decidim/rest_full/test/definitions/time_zone.rb +10 -0
- data/lib/decidim/rest_full/test/definitions/translated_prop.rb +11 -0
- data/lib/decidim/rest_full/test/definitions/user.rb +93 -0
- data/lib/decidim/rest_full/test/definitions/user_extended_data.rb +14 -0
- data/lib/decidim/rest_full/test/definitions/webhook.rb +95 -0
- data/lib/decidim/rest_full/test/definitions.rb +15 -0
- data/lib/decidim/rest_full/test/factories/api_client.rb +16 -0
- data/lib/decidim/rest_full/test/factories/magic_token.rb +13 -0
- data/lib/decidim/rest_full/test/factories/webhook_registration.rb +10 -0
- data/lib/decidim/rest_full/test/factories.rb +5 -0
- data/lib/decidim/rest_full/test/global_context.rb +11 -0
- data/lib/decidim/rest_full/test/on_api_endpoint_methods.rb +190 -0
- data/lib/decidim/rest_full/test/open_api_tag_registry.rb +25 -0
- data/lib/decidim/rest_full/test/openapi_specs.rb +107 -0
- data/lib/decidim/rest_full/test/shared_examples/has_extended_data.rb +41 -0
- data/lib/decidim/rest_full/test/shared_examples.rb +345 -0
- data/lib/decidim/rest_full/version.rb +27 -0
- data/lib/decidim/rest_full.rb +99 -0
- data/lib/decidim-restfull-core.rb +3 -0
- data/lib/tasks/decidim/rest_full/fire_webhook.rake +52 -0
- data/lib/tasks/decidim/rest_full/integrator_sandbox.rake +37 -0
- data/lib/tasks/decidim/rest_full/rest_full_upgrade.rake +64 -0
- data/lib/tasks/decidim/rest_full/rest_full_webpacker.rake +58 -0
- data/spec/commands/decidim/rest_full/core/impersonate_resource_owner_from_credentials_spec.rb +159 -0
- data/spec/commands/decidim/rest_full/core/syncronize_unconfirmed_host_spec.rb +117 -0
- data/spec/controllers/concerns/decidim/api/rest_full/collection_pagination_spec.rb +128 -0
- data/spec/decidim/rest_full/core/configuration_engine_disabled_routes_spec.rb +24 -0
- data/spec/forms/decidim/rest_full/core/magic_link_redirect_url_form_spec.rb +69 -0
- data/spec/forms/decidim/rest_full/core/webhook_registration_form_spec.rb +42 -0
- data/spec/jobs/decidim/rest_full/core/space_webhook_job_spec.rb +62 -0
- data/spec/jobs/decidim/rest_full/core/syncronize_unconfirmed_host_job_spec.rb +34 -0
- data/spec/jobs/decidim/rest_full/core/webhook_job_spec.rb +29 -0
- data/spec/jobs/decidim/rest_full/execute_api_job_job_spec.rb +45 -0
- data/spec/lib/decidim/rest_full/core/apartment_tenant_switch_spec.rb +26 -0
- data/spec/lib/decidim/rest_full/core/api_exception/bad_request_spec.rb +62 -0
- data/spec/lib/decidim/rest_full/core/definition_registry_add_resource_relationships_spec.rb +19 -0
- data/spec/lib/decidim/rest_full/core/gem_spec_paths_spec.rb +27 -0
- data/spec/lib/decidim/rest_full/core/http_cache/collection_fingerprint_spec.rb +59 -0
- data/spec/lib/decidim/rest_full/core/http_cache/fingerprint_contributor_registry_spec.rb +60 -0
- data/spec/lib/decidim/rest_full/core/http_cache/resource_show_fingerprint_spec.rb +33 -0
- data/spec/lib/decidim/rest_full/core/module_availability_spec.rb +130 -0
- data/spec/lib/decidim/rest_full/core/open_api_definition_paths_spec.rb +54 -0
- data/spec/lib/decidim/rest_full/core/optional_feature_gems_spec.rb +172 -0
- data/spec/lib/decidim/rest_full/core/roles/role_id_codec_spec.rb +62 -0
- data/spec/lib/decidim/rest_full/core/roles/roles_aggregator_spec.rb +53 -0
- data/spec/lib/decidim/rest_full/core/roles/roles_writer_spec.rb +38 -0
- data/spec/lib/decidim/rest_full/core/route_registry_spec.rb +90 -0
- data/spec/lib/decidim/rest_full/core/serializer_additions_registry_spec.rb +100 -0
- data/spec/lib/decidim/rest_full/core/settings_tab_spec.rb +15 -0
- data/spec/lib/decidim/rest_full/core/swagger_spec_paths_spec.rb +50 -0
- data/spec/lib/decidim/rest_full/core/webhook_dispatcher_proposal_published_spec.rb +63 -0
- data/spec/lib/decidim/rest_full/core/webhook_event_catalog_spec.rb +34 -0
- data/spec/lib/decidim/rest_full/routing_spec.rb +62 -0
- data/spec/lib/decidim/rest_full/test/apartment_spec.rb +17 -0
- data/spec/models/decidim/rest_full/api_job_spec.rb +51 -0
- data/spec/models/decidim/rest_full/application_mailer_override_spec.rb +60 -0
- data/spec/models/decidim/rest_full/core/has_extended_data_spec.rb +16 -0
- data/spec/models/decidim/rest_full/core/magic_token_spec.rb +68 -0
- data/spec/models/decidim/rest_full/core/webhook_registration_spec.rb +161 -0
- data/spec/models/decidim/rest_full/user_magic_token_spec.rb +51 -0
- data/spec/requests/decidim/api/rest_full/application_controller_introspect_spec.rb +85 -0
- data/spec/requests/decidim/api/rest_full/application_controller_ropc_spec.rb +299 -0
- data/spec/requests/decidim/api/rest_full/application_controller_token_spec.rb +57 -0
- data/spec/requests/decidim/api/rest_full/attachments/attachments_controller_direct_upload_spec.rb +39 -0
- data/spec/requests/decidim/api/rest_full/attachments/attachments_controller_index_spec.rb +41 -0
- data/spec/requests/decidim/api/rest_full/attachments/attachments_controller_show_spec.rb +34 -0
- data/spec/requests/decidim/api/rest_full/components/component_extended_data_controller_spec.rb +78 -0
- data/spec/requests/decidim/api/rest_full/components/components_controller_search_spec.rb +197 -0
- data/spec/requests/decidim/api/rest_full/components/components_controller_search_sql_spec.rb +48 -0
- data/spec/requests/decidim/api/rest_full/jobs/api_jobs_async_and_conditional_get_spec.rb +209 -0
- data/spec/requests/decidim/api/rest_full/jobs/jobs_controller_destroy_spec.rb +58 -0
- data/spec/requests/decidim/api/rest_full/jobs/jobs_controller_index_spec.rb +126 -0
- data/spec/requests/decidim/api/rest_full/jobs/jobs_controller_show_spec.rb +89 -0
- data/spec/requests/decidim/api/rest_full/module_availability_gate_spec.rb +77 -0
- data/spec/requests/decidim/api/rest_full/organizations/organization_extended_data_controller_index_spec.rb +88 -0
- data/spec/requests/decidim/api/rest_full/organizations/organization_extended_data_controller_update_spec.rb +194 -0
- data/spec/requests/decidim/api/rest_full/organizations/organizations_controller_index_spec.rb +57 -0
- data/spec/requests/decidim/api/rest_full/organizations/organizations_controller_show_spec.rb +66 -0
- data/spec/requests/decidim/api/rest_full/organizations/organizations_controller_update_spec.rb +120 -0
- data/spec/requests/decidim/api/rest_full/roles/roles_controller_create_spec.rb +230 -0
- data/spec/requests/decidim/api/rest_full/roles/roles_controller_destroy_spec.rb +52 -0
- data/spec/requests/decidim/api/rest_full/roles/roles_controller_index_spec.rb +127 -0
- data/spec/requests/decidim/api/rest_full/roles/roles_controller_show_spec.rb +215 -0
- data/spec/requests/decidim/api/rest_full/routes_boot_spec.rb +58 -0
- data/spec/requests/decidim/api/rest_full/scenarios/upsert_user_by_phone_and_set_locale_spec.rb +69 -0
- data/spec/requests/decidim/api/rest_full/spaces/space_extended_data_controller_spec.rb +78 -0
- data/spec/requests/decidim/api/rest_full/spaces/spaces_controller_index_spec.rb +167 -0
- data/spec/requests/decidim/api/rest_full/spaces/spaces_controller_search_spec.rb +280 -0
- data/spec/requests/decidim/api/rest_full/spaces/spaces_controller_show_spec.rb +98 -0
- data/spec/requests/decidim/api/rest_full/users/magic_links_controller_create_spec.rb +124 -0
- data/spec/requests/decidim/api/rest_full/users/magic_links_controller_show_spec.rb +84 -0
- data/spec/requests/decidim/api/rest_full/users/user_extended_data_controller_index_spec.rb +74 -0
- data/spec/requests/decidim/api/rest_full/users/user_extended_data_controller_update_spec.rb +192 -0
- data/spec/requests/decidim/api/rest_full/users/users_controller_index_spec.rb +182 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_events_controller_show_spec.rb +52 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_registrations_controller_create_spec.rb +95 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_registrations_controller_destroy_spec.rb +34 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_registrations_controller_index_spec.rb +43 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_registrations_controller_show_spec.rb +51 -0
- data/spec/requests/decidim/api/rest_full/webhooks/webhook_registrations_controller_update_spec.rb +57 -0
- data/spec/requests/decidim/rest_full/system/api_clients_controller_spec.rb +69 -0
- data/spec/serializers/decidim/api/rest_full/core/organization_webhook_serializer_spec.rb +18 -0
- data/spec/serializers/decidim/api/rest_full/core/space_webhook_serializer_spec.rb +44 -0
- data/spec/serializers/decidim/api/rest_full/core/user_webhook_serializer_spec.rb +19 -0
- data/spec/services/decidim/rest_full/core/api_system_operations_resource_extended_data_update_spec.rb +35 -0
- data/spec/services/decidim/rest_full/core/fire_webhook_spec.rb +59 -0
- data/spec/services/decidim/rest_full/core/participatory_process_step_activated_webhook_handler_spec.rb +57 -0
- metadata +482 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:rest_full_hypermedia_link) do
|
|
4
|
+
{
|
|
5
|
+
title: "Hypermedia link",
|
|
6
|
+
type: :object,
|
|
7
|
+
properties: {
|
|
8
|
+
href: { type: :string, description: "Target URL" },
|
|
9
|
+
title: { type: :string },
|
|
10
|
+
rel: { type: :string },
|
|
11
|
+
meta: {
|
|
12
|
+
type: :object,
|
|
13
|
+
properties: {
|
|
14
|
+
action_method: { type: :string, description: "HTTP method for the link target" }
|
|
15
|
+
},
|
|
16
|
+
additionalProperties: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
required: [:href, :rel],
|
|
20
|
+
additionalProperties: false
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:rest_full_api_job_links) do
|
|
25
|
+
{
|
|
26
|
+
title: "API job hypermedia controls",
|
|
27
|
+
type: :object,
|
|
28
|
+
properties: {
|
|
29
|
+
self: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:rest_full_hypermedia_link) }
|
|
30
|
+
},
|
|
31
|
+
required: [:self],
|
|
32
|
+
additionalProperties: false
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:rest_full_api_job_summary) do
|
|
37
|
+
{
|
|
38
|
+
title: "API job summary",
|
|
39
|
+
type: :object,
|
|
40
|
+
properties: {
|
|
41
|
+
id: {
|
|
42
|
+
type: :string,
|
|
43
|
+
format: :uuid,
|
|
44
|
+
description: "Job identifier; use with GET /jobs/{id}"
|
|
45
|
+
},
|
|
46
|
+
status: {
|
|
47
|
+
type: :string,
|
|
48
|
+
enum: %w(pending processing completed failed),
|
|
49
|
+
description: "Lifecycle state"
|
|
50
|
+
},
|
|
51
|
+
command_key: { type: :string, description: "Async handler key registered by the REST extension" },
|
|
52
|
+
created_at: { type: :string, format: :"date-time" },
|
|
53
|
+
updated_at: { type: :string, format: :"date-time" },
|
|
54
|
+
links: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:rest_full_api_job_links) }
|
|
55
|
+
},
|
|
56
|
+
required: [:id, :status, :command_key, :created_at, :updated_at, :links],
|
|
57
|
+
additionalProperties: false
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:rest_full_api_job_detail) do
|
|
62
|
+
{
|
|
63
|
+
title: "API job",
|
|
64
|
+
type: :object,
|
|
65
|
+
properties: {
|
|
66
|
+
id: {
|
|
67
|
+
type: :string,
|
|
68
|
+
format: :uuid,
|
|
69
|
+
description: "Job identifier from the HTTP 202 body"
|
|
70
|
+
},
|
|
71
|
+
status: { type: :string, enum: %w(pending processing completed failed) },
|
|
72
|
+
command_key: { type: :string },
|
|
73
|
+
created_at: { type: :string, format: :"date-time" },
|
|
74
|
+
updated_at: { type: :string, format: :"date-time" },
|
|
75
|
+
error_class: { type: :string, nullable: true },
|
|
76
|
+
error_message: { type: :string, nullable: true },
|
|
77
|
+
data: {
|
|
78
|
+
nullable: true,
|
|
79
|
+
description: "Success payload embedded from the worker (shape depends on command_key)"
|
|
80
|
+
},
|
|
81
|
+
return_value: {
|
|
82
|
+
nullable: true,
|
|
83
|
+
description: "Alias retained for backwards compatibility when present"
|
|
84
|
+
},
|
|
85
|
+
links: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:rest_full_api_job_links) }
|
|
86
|
+
},
|
|
87
|
+
required: [:id, :status, :command_key, :created_at, :updated_at, :links],
|
|
88
|
+
additionalProperties: true
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:rest_full_api_jobs_index_response) do
|
|
93
|
+
{
|
|
94
|
+
title: "API jobs index payload",
|
|
95
|
+
type: :object,
|
|
96
|
+
properties: {
|
|
97
|
+
data: {
|
|
98
|
+
type: :array,
|
|
99
|
+
items: {
|
|
100
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:rest_full_api_job_summary)
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
meta: {
|
|
104
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:collection_meta)
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
required: [:data, :meta],
|
|
108
|
+
additionalProperties: false
|
|
109
|
+
}
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:rest_full_api_job_accepted) do
|
|
113
|
+
{
|
|
114
|
+
title: "HTTP 202 async job envelope",
|
|
115
|
+
type: :object,
|
|
116
|
+
properties: {
|
|
117
|
+
job_id: { type: :string, format: :uuid },
|
|
118
|
+
status: { type: :string, enum: %w(pending) },
|
|
119
|
+
data: { nullable: true },
|
|
120
|
+
return_value: { nullable: true },
|
|
121
|
+
poll_url: {
|
|
122
|
+
type: :string,
|
|
123
|
+
description: "Absolute URL for GET /jobs/{job_id}; duplicate of links.self.href for flat JSON clients"
|
|
124
|
+
},
|
|
125
|
+
links: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:rest_full_api_job_links) }
|
|
126
|
+
},
|
|
127
|
+
required: [:job_id, :status, :data, :return_value, :poll_url, :links],
|
|
128
|
+
additionalProperties: false
|
|
129
|
+
}
|
|
130
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:locale) do
|
|
4
|
+
{
|
|
5
|
+
title: "Current locale",
|
|
6
|
+
description: "A single locale code configured for this Decidim instance.",
|
|
7
|
+
type: :string,
|
|
8
|
+
enum: Decidim.available_locales
|
|
9
|
+
}.freeze
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:locales) do
|
|
13
|
+
{
|
|
14
|
+
type: :array,
|
|
15
|
+
title: "Available locales",
|
|
16
|
+
description: "List of locale codes the organization exposes.",
|
|
17
|
+
items: { "$ref": Decidim::RestFull::Core::DefinitionRegistry.reference(:locale) }
|
|
18
|
+
}.freeze
|
|
19
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_resource(:magic_link) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "Magic Link",
|
|
7
|
+
properties: {
|
|
8
|
+
id: { type: :string, description: "Magic Token ID" },
|
|
9
|
+
type: { type: :string, enum: ["magic_link"] },
|
|
10
|
+
attributes: {
|
|
11
|
+
type: :object,
|
|
12
|
+
title: "Magic Link Attributes",
|
|
13
|
+
properties: {
|
|
14
|
+
token: { type: :string, description: "Magic Link Token" },
|
|
15
|
+
label: { type: :string, description: "Magic Link description" },
|
|
16
|
+
redirect_url: {
|
|
17
|
+
type: :string,
|
|
18
|
+
nullable: true,
|
|
19
|
+
description: "If set at create time, the GET sign-in flow redirects here after successful sign-in (HTTPS, allowlisted host)"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
required: [:token, :label]
|
|
23
|
+
},
|
|
24
|
+
links: {
|
|
25
|
+
type: :object,
|
|
26
|
+
title: "Magic Link links",
|
|
27
|
+
properties: {
|
|
28
|
+
self: Decidim::RestFull::Core::DefinitionRegistry.resource_link,
|
|
29
|
+
sign_in: Decidim::RestFull::Core::DefinitionRegistry.resource_link
|
|
30
|
+
},
|
|
31
|
+
required: [:self, :sign_in]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
required: [:attributes, :links, :id, :type],
|
|
35
|
+
additionalProperties: false
|
|
36
|
+
}.freeze
|
|
37
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:magic_link_redirect) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "Magic Redirect",
|
|
7
|
+
properties: {
|
|
8
|
+
id: { type: :string, description: "Magic Token ID" },
|
|
9
|
+
type: { type: :string, enum: ["magic_link_redirect"] },
|
|
10
|
+
attributes: {
|
|
11
|
+
type: :object,
|
|
12
|
+
title: "Magic Link Attributes",
|
|
13
|
+
properties: {
|
|
14
|
+
redirect_url: { type: :string, description: "Redirection destination" },
|
|
15
|
+
label: { type: :string, description: "Magic Link description" }
|
|
16
|
+
},
|
|
17
|
+
required: [:redirect_url, :label]
|
|
18
|
+
},
|
|
19
|
+
links: {
|
|
20
|
+
type: :object,
|
|
21
|
+
title: "Magic Link links",
|
|
22
|
+
properties: {
|
|
23
|
+
self: Decidim::RestFull::Core::DefinitionRegistry.get_action_link,
|
|
24
|
+
magic_link: Decidim::RestFull::Core::DefinitionRegistry.get_action_link
|
|
25
|
+
},
|
|
26
|
+
required: [:self, :magic_link]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
required: [:attributes, :links, :id, :type],
|
|
30
|
+
additionalProperties: false
|
|
31
|
+
}.freeze
|
|
32
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:space_manifest) do
|
|
4
|
+
{
|
|
5
|
+
title: "Space Manifest",
|
|
6
|
+
description: "Participatory space type key (Decidim manifest name).",
|
|
7
|
+
type: :string,
|
|
8
|
+
enum: Decidim.participatory_space_registry.manifests.map(&:name)
|
|
9
|
+
}.freeze
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:component_manifest) do
|
|
13
|
+
{
|
|
14
|
+
title: "Component Manifest",
|
|
15
|
+
description: "Component type key (Decidim manifest name).",
|
|
16
|
+
type: :string,
|
|
17
|
+
enum: Decidim.component_registry.manifests.map(&:name).reject { |manifest_name| manifest_name == :dummy }
|
|
18
|
+
}.freeze
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:resource_manifest) do
|
|
22
|
+
{
|
|
23
|
+
title: "Resource Type",
|
|
24
|
+
description: "Singular resource type string derived from active component manifests.",
|
|
25
|
+
type: :string,
|
|
26
|
+
enum: Decidim.component_registry.manifests.map(&:name).reject { |manifest_name| manifest_name == :dummy }.map { |manifest_name| manifest_name.to_s.singularize.to_s }
|
|
27
|
+
}.freeze
|
|
28
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:oauth_token_response) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "OAuth token response",
|
|
7
|
+
description: "Doorkeeper access token payload (RFC 6749).",
|
|
8
|
+
properties: {
|
|
9
|
+
access_token: { type: :string, description: "Bearer token value" },
|
|
10
|
+
token_type: { type: :string, enum: ["Bearer"] },
|
|
11
|
+
expires_in: { type: :integer, description: "Lifetime in seconds" },
|
|
12
|
+
scope: { type: :string, description: "Granted scopes (space-separated)" },
|
|
13
|
+
created_at: { type: :integer, description: "Unix timestamp when the token was issued" }
|
|
14
|
+
},
|
|
15
|
+
required: %w(access_token token_type expires_in scope created_at),
|
|
16
|
+
additionalProperties: false
|
|
17
|
+
}.freeze
|
|
18
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:organization_attributes) do
|
|
4
|
+
{
|
|
5
|
+
title: "Organization Attributes",
|
|
6
|
+
type: :object,
|
|
7
|
+
properties: {
|
|
8
|
+
name: {
|
|
9
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:translated_prop),
|
|
10
|
+
:additionalProperties => { type: :string }
|
|
11
|
+
},
|
|
12
|
+
description: {
|
|
13
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:translated_prop),
|
|
14
|
+
:additionalProperties => { type: :string }
|
|
15
|
+
},
|
|
16
|
+
reference_prefix: { type: :string, description: "Prefix for the organization. Used to prefix uploaded files and reference resources" },
|
|
17
|
+
host: { type: :string },
|
|
18
|
+
send_welcome_notification: { type: :boolean, description: "True if welcome email is sent to users" },
|
|
19
|
+
secondary_hosts: { type: :array, items: { type: :string, description: "Additional host, will redirect (301) to `host`" } },
|
|
20
|
+
available_locales: Decidim::RestFull::Core::DefinitionRegistry.schema_for(:locales),
|
|
21
|
+
default_locale: { type: :string, description: "Default locale for the organization" },
|
|
22
|
+
users_registration_mode: { type: :string, enum: %w(enabled existing disabled), description: <<~README
|
|
23
|
+
Define user registration mode:#{" "}
|
|
24
|
+
- `enabled`: Enable users registration
|
|
25
|
+
- `existing`: Existing users will be able to login. Registration will be disabled.
|
|
26
|
+
- `disabled`: No registration enabled
|
|
27
|
+
README
|
|
28
|
+
},
|
|
29
|
+
force_users_to_authenticate_before_access_organization: {
|
|
30
|
+
type: :boolean,
|
|
31
|
+
description: "Force users to authenticate before accessing the organization (disabled if users_registration_mode is `disabled`)"
|
|
32
|
+
},
|
|
33
|
+
badges_enabled: { type: :boolean, description: "Enable badges for public views" },
|
|
34
|
+
enable_participatory_space_filters: { type: :boolean, description: "Display areas and scopes filter in public views." },
|
|
35
|
+
enable_machine_translations: {
|
|
36
|
+
type: :boolean,
|
|
37
|
+
description: "Enable machine translations (must be configured, see [Using machine translations](https://docs.decidim.org/en/develop/develop/machine_translations.html))"
|
|
38
|
+
},
|
|
39
|
+
user_groups_enabled: { type: :boolean, description: "Enable user groups in public views" },
|
|
40
|
+
time_zone: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:time_zone) },
|
|
41
|
+
comments_max_length: { type: :integer, description: "Default maximum length of comments" },
|
|
42
|
+
rich_text_editor_in_public_views: { type: :boolean, description: "Enable rich text editor in public views" },
|
|
43
|
+
created_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:creation_date) },
|
|
44
|
+
updated_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:edition_date) },
|
|
45
|
+
extended_data: { type: :object, title: "Extended data for the organization" }
|
|
46
|
+
},
|
|
47
|
+
additionalProperties: false,
|
|
48
|
+
required: [:host, :name, :available_locales, :default_locale]
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_resource(:organization) do
|
|
53
|
+
{
|
|
54
|
+
type: :object,
|
|
55
|
+
title: "Organization",
|
|
56
|
+
properties: {
|
|
57
|
+
id: { type: :string },
|
|
58
|
+
type: { type: :string, enum: ["organization"] },
|
|
59
|
+
attributes: {
|
|
60
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:organization_attributes)
|
|
61
|
+
},
|
|
62
|
+
meta: {
|
|
63
|
+
title: "Organization Metadata",
|
|
64
|
+
type: :object,
|
|
65
|
+
properties: {
|
|
66
|
+
locales: Decidim::RestFull::Core::DefinitionRegistry.schema_for(:locales),
|
|
67
|
+
unconfirmed_host: { type: :string, description: "If host update is pending, unconfirmed host for the organization" }
|
|
68
|
+
},
|
|
69
|
+
required: [:locales],
|
|
70
|
+
additionalProperties: false
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
required: [:id, :type, :attributes, :meta]
|
|
74
|
+
}.freeze
|
|
75
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:organization_extended_data) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "Organization extended data",
|
|
7
|
+
properties: {
|
|
8
|
+
data: {
|
|
9
|
+
description: "Value at object_path (object, array, string, number, boolean, or null)."
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
required: [:data],
|
|
13
|
+
additionalProperties: true,
|
|
14
|
+
description: <<~README
|
|
15
|
+
Client metadata hash on an organization (`HasExtendedData`).
|
|
16
|
+
See [Extended data](#{Decidim::RestFull.config.docs_url}/integrator/extended-data).
|
|
17
|
+
README
|
|
18
|
+
}.freeze
|
|
19
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:publication_date) do
|
|
4
|
+
{
|
|
5
|
+
title: "Publication Date",
|
|
6
|
+
description: "Publication date, in ISO8601 format.",
|
|
7
|
+
type: :string,
|
|
8
|
+
format: :date_time,
|
|
9
|
+
example: "2024-12-12T20:34:56Z"
|
|
10
|
+
}.freeze
|
|
11
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:component_relationship_identifier) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "Component relationship identifier",
|
|
7
|
+
description: "JSON:API relationship pointer to a component.",
|
|
8
|
+
properties: {
|
|
9
|
+
id: { type: :string, description: "Component Id" },
|
|
10
|
+
type: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:component_type) }
|
|
11
|
+
},
|
|
12
|
+
required: [:id, :type],
|
|
13
|
+
additionalProperties: false
|
|
14
|
+
}.freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:resource_relationship_identifier) do
|
|
18
|
+
{
|
|
19
|
+
type: :object,
|
|
20
|
+
title: "Resource relationship identifier",
|
|
21
|
+
description: "JSON:API relationship pointer to a component resource (proposal, meeting, etc.).",
|
|
22
|
+
properties: {
|
|
23
|
+
id: { type: :string, description: "Resource Id" },
|
|
24
|
+
type: { type: :string, description: "Resource type (e.g. proposals, meetings)" }
|
|
25
|
+
},
|
|
26
|
+
required: [:id, :type],
|
|
27
|
+
additionalProperties: false
|
|
28
|
+
}.freeze
|
|
29
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:resource_extended_data) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "Resource extended data",
|
|
7
|
+
properties: {
|
|
8
|
+
data: {
|
|
9
|
+
description: "Value at the requested object_path (`.` for the full hash)."
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
required: [:data],
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
description: <<~README
|
|
15
|
+
Client metadata hash on a Decidim resource (`HasExtendedData`).
|
|
16
|
+
Kept out of the Decidim admin UI.
|
|
17
|
+
See [Extended data](#{Decidim::RestFull.config.docs_url}/integrator/extended-data).
|
|
18
|
+
README
|
|
19
|
+
}.freeze
|
|
20
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:role_attributes) do
|
|
4
|
+
{
|
|
5
|
+
title: "Role Attributes",
|
|
6
|
+
type: :object,
|
|
7
|
+
properties: {
|
|
8
|
+
user_id: {
|
|
9
|
+
type: :integer,
|
|
10
|
+
description: "ID of the user associated to the role (nullable for pending invitations)"
|
|
11
|
+
},
|
|
12
|
+
resource_id: {
|
|
13
|
+
type: :integer,
|
|
14
|
+
description: "ID of the resource (organization or participatory space) the role is attached to"
|
|
15
|
+
},
|
|
16
|
+
resource_type: {
|
|
17
|
+
type: :string,
|
|
18
|
+
description: "Type of the resource (e.g. Organization, Decidim::ParticipatoryProcess)"
|
|
19
|
+
},
|
|
20
|
+
type: {
|
|
21
|
+
type: :string,
|
|
22
|
+
description: "Kind of role",
|
|
23
|
+
enum: %w(general_admin space_private_member space_administrator space_moderator space_valuator)
|
|
24
|
+
},
|
|
25
|
+
invited_at: {
|
|
26
|
+
type: :string,
|
|
27
|
+
format: :"date-time",
|
|
28
|
+
nullable: true,
|
|
29
|
+
description: "Invitation timestamp if the role was created via invitation"
|
|
30
|
+
},
|
|
31
|
+
accepted_invite: {
|
|
32
|
+
type: :boolean,
|
|
33
|
+
description: "Whether the invitation has been accepted"
|
|
34
|
+
},
|
|
35
|
+
created_at: {
|
|
36
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:creation_date)
|
|
37
|
+
},
|
|
38
|
+
updated_at: {
|
|
39
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:edition_date)
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
required: [:type, :resource_id, :resource_type, :created_at],
|
|
43
|
+
additionalProperties: false
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_resource(:role) do
|
|
48
|
+
{
|
|
49
|
+
type: :object,
|
|
50
|
+
title: "Role",
|
|
51
|
+
properties: {
|
|
52
|
+
id: { type: :string },
|
|
53
|
+
type: { type: :string, enum: ["role"] },
|
|
54
|
+
attributes: {
|
|
55
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:role_attributes)
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
required: [:id, :type, :attributes],
|
|
59
|
+
additionalProperties: false
|
|
60
|
+
}.freeze
|
|
61
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../open_api_tag_registry"
|
|
4
|
+
|
|
5
|
+
# Primitives and cross-cutting definitions (used by core and domain definitions).
|
|
6
|
+
require_relative "collection_meta"
|
|
7
|
+
require_relative "translated_prop"
|
|
8
|
+
require_relative "time_zone"
|
|
9
|
+
require_relative "component_type"
|
|
10
|
+
require_relative "filter_param"
|
|
11
|
+
require_relative "creation_date"
|
|
12
|
+
require_relative "edition_date"
|
|
13
|
+
require_relative "publication_date"
|
|
14
|
+
require_relative "grant_param"
|
|
15
|
+
require_relative "oauth_token_response"
|
|
16
|
+
require_relative "relationship_identifier"
|
|
17
|
+
require_relative "manifests"
|
|
18
|
+
require_relative "tags"
|
|
19
|
+
require_relative "error"
|
|
20
|
+
require_relative "health"
|
|
21
|
+
require_relative "introspect_data"
|
|
22
|
+
require_relative "locales_param"
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:space_type) do
|
|
4
|
+
{
|
|
5
|
+
type: :string,
|
|
6
|
+
enum: Decidim.participatory_space_registry.manifests.map(&:name)
|
|
7
|
+
}.freeze
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:space_classes) do
|
|
11
|
+
{
|
|
12
|
+
type: :string,
|
|
13
|
+
description: "space class name. Part of the polymorphic association (participatory_space_type,participatory_space_id)",
|
|
14
|
+
enum: Decidim.participatory_space_registry.manifests.map(&:model_class_name)
|
|
15
|
+
}.freeze
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_resource(:space) do
|
|
19
|
+
{
|
|
20
|
+
type: :object,
|
|
21
|
+
title: "Space",
|
|
22
|
+
properties: {
|
|
23
|
+
id: { type: :string, description: "Space Id" },
|
|
24
|
+
type: { type: :string, enum: ["space"] },
|
|
25
|
+
attributes: {
|
|
26
|
+
title: "Space Attributes",
|
|
27
|
+
type: :object,
|
|
28
|
+
properties: {
|
|
29
|
+
title: {
|
|
30
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:translated_prop),
|
|
31
|
+
:title => "Title translations",
|
|
32
|
+
:description => "Space title"
|
|
33
|
+
},
|
|
34
|
+
subtitle: {
|
|
35
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:translated_prop),
|
|
36
|
+
:title => "Subtitle translations",
|
|
37
|
+
:description => "Space subtitle"
|
|
38
|
+
},
|
|
39
|
+
short_description: {
|
|
40
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:translated_prop),
|
|
41
|
+
:title => "Short Description translations",
|
|
42
|
+
:description => "Space short_description"
|
|
43
|
+
},
|
|
44
|
+
description: {
|
|
45
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:translated_prop),
|
|
46
|
+
:title => "Description translations",
|
|
47
|
+
:description => "Space description"
|
|
48
|
+
},
|
|
49
|
+
manifest_name: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:space_manifest) },
|
|
50
|
+
participatory_space_type: { type: :string, example: "Decidim::Assembly" },
|
|
51
|
+
extended_data: {
|
|
52
|
+
type: :object,
|
|
53
|
+
additionalProperties: true,
|
|
54
|
+
description: "Present when the client has public.space.extended_data.read"
|
|
55
|
+
},
|
|
56
|
+
visibility: { type: :string, enum: %w(public transparent private), description: "Space visibility" },
|
|
57
|
+
created_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:creation_date) },
|
|
58
|
+
updated_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:edition_date) }
|
|
59
|
+
},
|
|
60
|
+
required: [:title, :manifest_name, :visibility, :created_at, :updated_at],
|
|
61
|
+
additionalProperties: false
|
|
62
|
+
},
|
|
63
|
+
relationships: {
|
|
64
|
+
type: :object,
|
|
65
|
+
title: "Space relationships",
|
|
66
|
+
properties: {
|
|
67
|
+
components: Decidim::RestFull::Core::DefinitionRegistry.has_many_relation(
|
|
68
|
+
nil,
|
|
69
|
+
title: "Space Component Relationships",
|
|
70
|
+
item_schema_key: :component_relationship_identifier
|
|
71
|
+
) do |components_schema|
|
|
72
|
+
components_schema[:properties][:meta] = {
|
|
73
|
+
|
|
74
|
+
title: "Space Component Metadata",
|
|
75
|
+
type: :object,
|
|
76
|
+
properties: {
|
|
77
|
+
count: { type: :integer, description: "Total count for components association" }
|
|
78
|
+
},
|
|
79
|
+
additionalProperties: false,
|
|
80
|
+
required: [:count]
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
components_schema[:properties][:links] = {
|
|
84
|
+
type: :object,
|
|
85
|
+
title: "Space Component Links",
|
|
86
|
+
properties: {
|
|
87
|
+
self: Decidim::RestFull::Core::DefinitionRegistry.resource_link,
|
|
88
|
+
related: Decidim::RestFull::Core::DefinitionRegistry.resource_link
|
|
89
|
+
},
|
|
90
|
+
additionalProperties: false,
|
|
91
|
+
required: [:self]
|
|
92
|
+
}
|
|
93
|
+
components_schema[:required].push(:meta)
|
|
94
|
+
components_schema[:required].push(:links)
|
|
95
|
+
components_schema
|
|
96
|
+
end
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
links: {
|
|
100
|
+
type: :object,
|
|
101
|
+
title: "Space Links",
|
|
102
|
+
properties: {
|
|
103
|
+
self: Decidim::RestFull::Core::DefinitionRegistry.resource_link,
|
|
104
|
+
related: Decidim::RestFull::Core::DefinitionRegistry.resource_link
|
|
105
|
+
},
|
|
106
|
+
required: [:self, :related],
|
|
107
|
+
additionalProperties: false
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
required: [:id, :type, :attributes, :links, :relationships]
|
|
111
|
+
}.freeze
|
|
112
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module RestFull
|
|
5
|
+
module Definitions
|
|
6
|
+
module Tags
|
|
7
|
+
ATTACHMENTS = {
|
|
8
|
+
name: "Attachments",
|
|
9
|
+
description: <<~TXT.strip
|
|
10
|
+
Manage **Decidim::Attachment** rows (files linked to proposals, spaces, etc.).
|
|
11
|
+
|
|
12
|
+
**Create (mode A):** `POST /attachments` with `multipart/form-data` (`file`, `attached_to_type`, `attached_to_id`, translated `title` / `description`).
|
|
13
|
+
|
|
14
|
+
**Create (mode B):** `POST /attachments/direct_upload` → use `signed_id` in `POST /attachments` (`application/json`).
|
|
15
|
+
|
|
16
|
+
**Update:** metadata only (`PUT /attachments/{id}`) — no file replacement in v1.
|
|
17
|
+
|
|
18
|
+
**List filters:** `filter[attached_to_type]`, `filter[attached_to_id]`, `filter[attachment_collection_id]`, `filter[file_type]` (`image`, `document`, `link`).
|
|
19
|
+
TXT
|
|
20
|
+
}.freeze
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
Decidim::RestFull::Test::OpenApiTagRegistry.register_tag(Decidim::RestFull::Definitions::Tags::ATTACHMENTS)
|