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,96 @@
|
|
|
1
|
+
# Definitions
|
|
2
|
+
This folder keeps all Open API definitions. You will find most of the swagger documentation in these files.
|
|
3
|
+
The declared shemas will be tested on each rswag requests.
|
|
4
|
+
|
|
5
|
+
## Guidelines
|
|
6
|
+
|
|
7
|
+
**Do not use `example`**<br />
|
|
8
|
+
Use example generation from rswag. Do not document examples in definitions
|
|
9
|
+
```
|
|
10
|
+
# BAD
|
|
11
|
+
title: {type: :string, example: "Gello"}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
# GOOD:
|
|
16
|
+
run_example!(example_name: :ok)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Use `title`**<br />
|
|
20
|
+
The `title` property will be used by the generator to generate function names and types name.
|
|
21
|
+
Use it then to describe briefly the resource.
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
# BAD: extended_data will be typed RelashionShipUserExtendedData
|
|
25
|
+
relashionship: {
|
|
26
|
+
type: :object,
|
|
27
|
+
properties: {
|
|
28
|
+
user: {
|
|
29
|
+
type: :object,
|
|
30
|
+
properties: {
|
|
31
|
+
extended_data: {type: :object}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
# GOOD: extended_data will be typed UserExtendedData
|
|
40
|
+
relashionship: {
|
|
41
|
+
type: :object,
|
|
42
|
+
properties: {
|
|
43
|
+
user: {
|
|
44
|
+
type: :object,
|
|
45
|
+
properties: {
|
|
46
|
+
extended_data: {type: :object, title: "User Extended Data"}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Use `required`**<br />
|
|
54
|
+
For `type: :object`, require the properties than are always presents. Typed languages like typescript will
|
|
55
|
+
then resolve better the types, and your test coverages will be better.
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
# BAD
|
|
59
|
+
hello: {
|
|
60
|
+
type: :object,
|
|
61
|
+
properties: {
|
|
62
|
+
message: {type: :string}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
# GOOD
|
|
69
|
+
hello: {
|
|
70
|
+
type: :object,
|
|
71
|
+
properties: {
|
|
72
|
+
message: {type: :string}
|
|
73
|
+
},
|
|
74
|
+
required: [:message]
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Use markdown and `<<~README`**<br />
|
|
79
|
+
For multi line description or more complete documentation, use Heredoc annotations to write your content.
|
|
80
|
+
Use markdown:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
# BAD
|
|
84
|
+
title: {type: :string, description: "my quiet long description\n, multilines."}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
# GOOD
|
|
89
|
+
title: {
|
|
90
|
+
type: :string,
|
|
91
|
+
description: <<~README
|
|
92
|
+
my quiet long description
|
|
93
|
+
, multilines.
|
|
94
|
+
README
|
|
95
|
+
}
|
|
96
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:attachment_attached_to) do
|
|
4
|
+
{
|
|
5
|
+
title: "Attachment parent reference",
|
|
6
|
+
type: :object,
|
|
7
|
+
properties: {
|
|
8
|
+
type: { type: :string, description: "Polymorphic type (e.g. Decidim::Proposals::Proposal)" },
|
|
9
|
+
id: { type: :integer }
|
|
10
|
+
},
|
|
11
|
+
required: [:type, :id],
|
|
12
|
+
additionalProperties: false
|
|
13
|
+
}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:attachment_attributes) do
|
|
17
|
+
{
|
|
18
|
+
title: "Attachment attributes",
|
|
19
|
+
type: :object,
|
|
20
|
+
properties: {
|
|
21
|
+
title: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:translated_prop) },
|
|
22
|
+
description: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:translated_prop) },
|
|
23
|
+
weight: { type: :integer },
|
|
24
|
+
attachment_collection_id: { type: :integer, nullable: true },
|
|
25
|
+
file_type: { type: :string, enum: %w(image document link) },
|
|
26
|
+
content_type: { type: :string, nullable: true },
|
|
27
|
+
url: { type: :string, nullable: true, description: "Public URL when file is attached" },
|
|
28
|
+
thumbnail_url: { type: :string, nullable: true },
|
|
29
|
+
attached_to: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:attachment_attached_to) },
|
|
30
|
+
created_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:creation_date) },
|
|
31
|
+
updated_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:edition_date) }
|
|
32
|
+
},
|
|
33
|
+
required: [:title, :attached_to, :created_at],
|
|
34
|
+
additionalProperties: false
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_resource(:attachment) do
|
|
39
|
+
{
|
|
40
|
+
type: :object,
|
|
41
|
+
title: "Attachment",
|
|
42
|
+
properties: {
|
|
43
|
+
id: { type: :string },
|
|
44
|
+
type: { type: :string, enum: ["attachment"] },
|
|
45
|
+
attributes: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:attachment_attributes) }
|
|
46
|
+
},
|
|
47
|
+
required: [:id, :type, :attributes],
|
|
48
|
+
additionalProperties: false
|
|
49
|
+
}.freeze
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:attachment_direct_upload_response) do
|
|
53
|
+
{
|
|
54
|
+
type: :object,
|
|
55
|
+
properties: {
|
|
56
|
+
signed_id: { type: :string },
|
|
57
|
+
filename: { type: :string },
|
|
58
|
+
content_type: { type: :string },
|
|
59
|
+
byte_size: { type: :integer }
|
|
60
|
+
},
|
|
61
|
+
required: [:signed_id, :filename, :content_type, :byte_size],
|
|
62
|
+
additionalProperties: false
|
|
63
|
+
}
|
|
64
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:collection_meta) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "Collection pagination metadata",
|
|
7
|
+
properties: {
|
|
8
|
+
page: { type: :integer, minimum: 1, description: "Current page (1-based)" },
|
|
9
|
+
per_page: { type: :integer, minimum: 1, maximum: 100, description: "Page size (default 20, max 100)" },
|
|
10
|
+
has_more: {
|
|
11
|
+
type: :boolean,
|
|
12
|
+
description: "True when another page may exist (limit+1, no COUNT). Always true when order=rand (RANDOM() is unstable across pages)."
|
|
13
|
+
},
|
|
14
|
+
next: { type: :string, nullable: true, description: "Absolute URL for the next page, or null" },
|
|
15
|
+
prev: { type: :string, nullable: true, description: "Absolute URL for the previous page, or null" }
|
|
16
|
+
},
|
|
17
|
+
required: [:page, :per_page, :has_more],
|
|
18
|
+
additionalProperties: false
|
|
19
|
+
}
|
|
20
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Polymorphic JSON:API +:component+ (+oneOf+ of manifest-specific schemas + +:other_component+) is
|
|
4
|
+
# built by +DefinitionRegistry.finalize_openapi_component_resource_schema!+ after optional engines call
|
|
5
|
+
# +register_component_manifest_schema+.
|
|
6
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:generic_component) do
|
|
7
|
+
{
|
|
8
|
+
type: :object,
|
|
9
|
+
title: "Component",
|
|
10
|
+
properties: {
|
|
11
|
+
id: { type: :string, description: "Component Id" },
|
|
12
|
+
type: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:component_type) },
|
|
13
|
+
attributes: {
|
|
14
|
+
title: "Component Attributes",
|
|
15
|
+
type: :object,
|
|
16
|
+
properties: {
|
|
17
|
+
name: {
|
|
18
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:translated_prop),
|
|
19
|
+
:description => "Component name"
|
|
20
|
+
},
|
|
21
|
+
global_announcement: {
|
|
22
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:translated_prop),
|
|
23
|
+
:description => "Component announcement (intro)"
|
|
24
|
+
},
|
|
25
|
+
participatory_space_type: {
|
|
26
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:space_classes)
|
|
27
|
+
},
|
|
28
|
+
participatory_space_id: { type: :string, description: "Associate space id. Part of the polymorphic association (participatory_space_type,participatory_space_id)" },
|
|
29
|
+
created_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:creation_date) },
|
|
30
|
+
updated_at: { "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:edition_date) },
|
|
31
|
+
extended_data: {
|
|
32
|
+
type: :object,
|
|
33
|
+
additionalProperties: true,
|
|
34
|
+
description: "Present when the client has public.component.extended_data.read"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
required: [:created_at, :updated_at, :name, :manifest_name, :participatory_space_type, :participatory_space_id],
|
|
38
|
+
additionalProperties: false
|
|
39
|
+
},
|
|
40
|
+
meta: {
|
|
41
|
+
type: :object,
|
|
42
|
+
title: "Component Metadata",
|
|
43
|
+
properties: {
|
|
44
|
+
published: { type: :boolean, description: "Published component?" },
|
|
45
|
+
scopes_enabled: { type: :boolean, description: "Component handle scopes?" }
|
|
46
|
+
},
|
|
47
|
+
additionalProperties: {
|
|
48
|
+
oneOf: [
|
|
49
|
+
{
|
|
50
|
+
type: :boolean
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: :integer
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: :string
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:translated_prop)
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
required: [:published, :scopes_enabled]
|
|
64
|
+
},
|
|
65
|
+
links: {
|
|
66
|
+
type: :object,
|
|
67
|
+
title: "Component Links",
|
|
68
|
+
properties: {
|
|
69
|
+
self: Decidim::RestFull::Core::DefinitionRegistry.resource_link,
|
|
70
|
+
related: Decidim::RestFull::Core::DefinitionRegistry.resource_link
|
|
71
|
+
},
|
|
72
|
+
additionalProperties: false,
|
|
73
|
+
required: [:self]
|
|
74
|
+
},
|
|
75
|
+
relationships: {
|
|
76
|
+
type: :object,
|
|
77
|
+
title: "Component Relationships",
|
|
78
|
+
properties: {
|
|
79
|
+
resources: Decidim::RestFull::Core::DefinitionRegistry.has_many_relation(
|
|
80
|
+
nil,
|
|
81
|
+
title: "Component Linked Resources",
|
|
82
|
+
item_schema_key: :resource_relationship_identifier
|
|
83
|
+
) do |component_schema|
|
|
84
|
+
component_schema[:properties][:meta] = {
|
|
85
|
+
type: :object,
|
|
86
|
+
title: "Component Linked Resources Metadata",
|
|
87
|
+
properties: {
|
|
88
|
+
count: { type: :integer, description: "Total count of resources" }
|
|
89
|
+
},
|
|
90
|
+
required: [:count]
|
|
91
|
+
}
|
|
92
|
+
component_schema[:required].push(:meta)
|
|
93
|
+
component_schema
|
|
94
|
+
end
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}.freeze
|
|
99
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:component_type) do
|
|
4
|
+
{
|
|
5
|
+
type: :string,
|
|
6
|
+
enum: Decidim.component_registry.manifests.map { |manifest| "#{manifest.name.to_s.singularize}_component" }.reject { |manifest_name| manifest_name == "dummy_component" }
|
|
7
|
+
}
|
|
8
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Core API resource definitions (organizations, spaces, users, roles, etc.).
|
|
4
|
+
require_relative "role"
|
|
5
|
+
require_relative "space"
|
|
6
|
+
require_relative "component"
|
|
7
|
+
require_relative "organization"
|
|
8
|
+
require_relative "organization_extended_data"
|
|
9
|
+
require_relative "resource_extended_data"
|
|
10
|
+
require_relative "user_extended_data"
|
|
11
|
+
require_relative "user"
|
|
12
|
+
require_relative "magic_link"
|
|
13
|
+
require_relative "magic_link_redirect"
|
|
14
|
+
require_relative "job"
|
|
15
|
+
require_relative "attachment"
|
|
16
|
+
require_relative "webhook"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:creation_date) do
|
|
4
|
+
{
|
|
5
|
+
title: "Creation date",
|
|
6
|
+
description: "Creation date, in ISO8601 format.",
|
|
7
|
+
type: :string,
|
|
8
|
+
format: :date_time,
|
|
9
|
+
example: "2024-11-12T12:34:56Z"
|
|
10
|
+
}.freeze
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:edition_date) do
|
|
4
|
+
{
|
|
5
|
+
title: "Last Update Date",
|
|
6
|
+
description: "Last update 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,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:error_detail) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "API error detail",
|
|
7
|
+
properties: {
|
|
8
|
+
code: { type: :string, description: "Stable ActiveModel error type (e.g. `blank`, `too_short`, `too_much_caps`)." },
|
|
9
|
+
field: { type: :string, description: "Attribute name when the error targets a request field (e.g. `title`, `body`)." },
|
|
10
|
+
description: { type: :string, description: "Human-readable full message for this single validation error." }
|
|
11
|
+
},
|
|
12
|
+
additionalProperties: false,
|
|
13
|
+
required: [:code]
|
|
14
|
+
}.freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:error) do
|
|
18
|
+
{
|
|
19
|
+
type: :object,
|
|
20
|
+
title: "API error payload",
|
|
21
|
+
properties: {
|
|
22
|
+
error: { type: :string, description: "Summary label; typically includes HTTP status (e.g. `400: Bad request`)." },
|
|
23
|
+
error_description: { type: :string, description: "Human-readable detail; for many 4xx responses this is the validation or exception message." },
|
|
24
|
+
error_details: {
|
|
25
|
+
type: :array,
|
|
26
|
+
description: "Machine-readable validation errors when present (e.g. draft proposal update/publish). One entry per ActiveModel error.",
|
|
27
|
+
items: { "$ref": Decidim::RestFull::Core::DefinitionRegistry.reference(:error_detail) }
|
|
28
|
+
},
|
|
29
|
+
state: { type: :string, description: "Optional OAuth layer hint present on some token errors (e.g. `unauthorized`)." }
|
|
30
|
+
},
|
|
31
|
+
additionalProperties: false,
|
|
32
|
+
required: [:error, :error_description]
|
|
33
|
+
}.freeze
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:error_response) do
|
|
37
|
+
{
|
|
38
|
+
"$ref": Decidim::RestFull::Core::DefinitionRegistry.reference(:error)
|
|
39
|
+
}.freeze
|
|
40
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Api
|
|
4
|
+
module Definitions
|
|
5
|
+
FILTER_PARAM = lambda do |filter, item_schema = { type: :string }, exclude_filters = []|
|
|
6
|
+
[
|
|
7
|
+
{
|
|
8
|
+
name: "filter[#{filter}_not_in][]", in: :query, style: :form, explode: true, schema: {
|
|
9
|
+
type: :array,
|
|
10
|
+
items: item_schema,
|
|
11
|
+
title: "#{filter} not IN filter",
|
|
12
|
+
description: "match none of _#{filter}_'s values in array"
|
|
13
|
+
}, required: false
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "filter[#{filter}_in][]", in: :query, style: :form, explode: true, schema: {
|
|
17
|
+
type: :array,
|
|
18
|
+
items: item_schema,
|
|
19
|
+
title: "#{filter} IN filter",
|
|
20
|
+
description: "match one of _#{filter}_'s values in array"
|
|
21
|
+
}, required: false
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "filter[#{filter}_start]", in: :query, schema: {
|
|
25
|
+
type: :string,
|
|
26
|
+
description: "_#{filter}_ starts with",
|
|
27
|
+
title: "#{filter} starts With filter",
|
|
28
|
+
example: "some_string"
|
|
29
|
+
}, required: false
|
|
30
|
+
}, {
|
|
31
|
+
name: "filter[#{filter}_not_start]", in: :query, schema: {
|
|
32
|
+
type: :string,
|
|
33
|
+
description: "_#{filter}_ does not start with",
|
|
34
|
+
title: "#{filter} not starts With filter",
|
|
35
|
+
example: "some_string"
|
|
36
|
+
}, required: false
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "filter[#{filter}_eq]", in: :query, schema: {
|
|
40
|
+
**item_schema,
|
|
41
|
+
title: "#{filter} equal filter",
|
|
42
|
+
description: "_#{filter}_ is equal to"
|
|
43
|
+
}, required: false
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "filter[#{filter}_not_eq]", in: :query, schema: {
|
|
47
|
+
**item_schema,
|
|
48
|
+
title: "#{filter} not equal filter",
|
|
49
|
+
description: "_#{filter}_ is NOT equal to"
|
|
50
|
+
}, required: false
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "filter[#{filter}_matches]", in: :query, schema: {
|
|
54
|
+
type: :string,
|
|
55
|
+
title: "#{filter} like filter",
|
|
56
|
+
description: "matches _#{filter}_ with `LIKE`",
|
|
57
|
+
example: "%some_string"
|
|
58
|
+
}, required: false
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "filter[#{filter}_does_not_match]", in: :query, schema: {
|
|
62
|
+
type: :string,
|
|
63
|
+
title: "#{filter} not like filter",
|
|
64
|
+
description: "Does not match _#{filter}_ with `LIKE`"
|
|
65
|
+
}, required: false
|
|
66
|
+
},
|
|
67
|
+
{ name: "filter[#{filter}_lt]", in: :query, schema: {
|
|
68
|
+
**item_schema,
|
|
69
|
+
title: "#{filter} less than filter",
|
|
70
|
+
description: "_#{filter}_ is less than"
|
|
71
|
+
}, required: false },
|
|
72
|
+
{
|
|
73
|
+
name: "filter[#{filter}_gt]", in: :query, schema: {
|
|
74
|
+
**item_schema,
|
|
75
|
+
title: "#{filter} greater than filter",
|
|
76
|
+
description: "_#{filter}_ is greater than"
|
|
77
|
+
}, required: false
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "filter[#{filter}_present]", in: :query, schema: {
|
|
81
|
+
type: :boolean,
|
|
82
|
+
title: "#{filter} present filter",
|
|
83
|
+
description: "_#{filter}_ is not null and not empty"
|
|
84
|
+
}, required: false
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "filter[#{filter}_blank]", in: :query, schema: {
|
|
88
|
+
type: :boolean,
|
|
89
|
+
title: "#{filter} blank filter",
|
|
90
|
+
description: "_#{filter}_ is null or empty"
|
|
91
|
+
}, required: false
|
|
92
|
+
}
|
|
93
|
+
].reject do |filter_param|
|
|
94
|
+
name = filter_param[:name]
|
|
95
|
+
excluded = exclude_filters.map do |suffix|
|
|
96
|
+
[
|
|
97
|
+
"filter[#{filter}_#{suffix}]",
|
|
98
|
+
"filter[#{filter}_#{suffix}][]"
|
|
99
|
+
]
|
|
100
|
+
end.flatten
|
|
101
|
+
excluded.include?(name)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:client_credential) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "Client Credential",
|
|
7
|
+
properties: {
|
|
8
|
+
grant_type: { type: :string, enum: ["client_credentials"], description: "Client Credential Flow, for **machine-to-machine**" },
|
|
9
|
+
client_id: { type: :string, description: "OAuth application Client Id" },
|
|
10
|
+
client_secret: { type: :string, description: "OAuth application Client Secret" },
|
|
11
|
+
scope: { type: :string, enum: Doorkeeper.configuration.scopes.to_a.map(&:to_s), description: "Requested scopes" }
|
|
12
|
+
},
|
|
13
|
+
required: %w(grant_type client_id client_secret scope)
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:password_grant_login) do
|
|
17
|
+
{
|
|
18
|
+
type: :object,
|
|
19
|
+
title: "Login",
|
|
20
|
+
properties: {
|
|
21
|
+
grant_type: { type: :string, enum: ["password"], description: "Resource Owner Password Credentials (ROPC) Flow, for **user login**" },
|
|
22
|
+
auth_type: { type: :string, enum: ["login"], description: "Type of ROPC" },
|
|
23
|
+
username: { type: :string, description: "User nickname" },
|
|
24
|
+
password: { type: :string, description: "User password" },
|
|
25
|
+
client_id: { type: :string, description: "OAuth application Client Id" },
|
|
26
|
+
client_secret: { type: :string, description: "OAuth application Client Secret" },
|
|
27
|
+
scope: { type: :string, enum: Doorkeeper.configuration.scopes.to_a.reject { |scope| scope == "system" }, description: "Request scopes" }
|
|
28
|
+
},
|
|
29
|
+
required: %w(grant_type client_id client_secret scope username password auth_type)
|
|
30
|
+
}.freeze
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:password_grant_impersonate) do
|
|
34
|
+
{
|
|
35
|
+
type: :object,
|
|
36
|
+
title: "Impersonation",
|
|
37
|
+
properties: {
|
|
38
|
+
grant_type: { type: :string, enum: ["password"], description: "Resource Owner Password Credentials (ROPC) Flow, for **user impersonation**" },
|
|
39
|
+
auth_type: { type: :string, enum: ["impersonate"], description: "Type of ROPC" },
|
|
40
|
+
username: { type: :string, description: "User nickname, unique and at least 6 alphanumeric chars." },
|
|
41
|
+
id: { type: :string, description: "User id, will find over id and ignore username. Fails if register_on_missing=true." },
|
|
42
|
+
meta: {
|
|
43
|
+
type: :object,
|
|
44
|
+
title: "User impersonation settings",
|
|
45
|
+
description: "Impersonation Settings",
|
|
46
|
+
properties: {
|
|
47
|
+
register_on_missing: { type: :boolean, description: "Register the user if they do not exist. Default: false" },
|
|
48
|
+
accept_tos_on_register: { type: :boolean, description: "Accept the TOS on registration, used only if register_on_missing=true. Default: false" },
|
|
49
|
+
skip_confirmation_on_register: { type: :boolean, description: "Skip email confirmation on creation, used only if register_on_missing=true. Default: false" },
|
|
50
|
+
email: { type: :string, description: "User email to use on registration. used only if register_on_missing=true. Default to <username>@example.org" },
|
|
51
|
+
name: { type: :string, description: "User name. Used only if register_on_missing=true. Default to username" },
|
|
52
|
+
locale: { type: :string, description: "Participant locale. Applied on create and when the user already exists. Must be an organization locale." }
|
|
53
|
+
},
|
|
54
|
+
additionalProperties: false
|
|
55
|
+
},
|
|
56
|
+
client_id: { type: :string, description: "OAuth application Client Id" },
|
|
57
|
+
client_secret: { type: :string, description: "OAuth application Client Secret" },
|
|
58
|
+
scope: { type: :string, enum: Doorkeeper.configuration.scopes.to_a.reject { |scope| scope == "system" }, description: "Request scopes" }
|
|
59
|
+
},
|
|
60
|
+
additionalProperties: false,
|
|
61
|
+
required: %w(grant_type client_id client_secret scope auth_type)
|
|
62
|
+
}.freeze
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:oauth_grant_param) do
|
|
66
|
+
{
|
|
67
|
+
oneOf: [
|
|
68
|
+
{ "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:client_credential) },
|
|
69
|
+
{ "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:password_grant_impersonate) },
|
|
70
|
+
{ "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:password_grant_login) }
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:password_grant_param) do
|
|
76
|
+
{
|
|
77
|
+
oneOf: [
|
|
78
|
+
{ "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:password_grant_impersonate) },
|
|
79
|
+
{ "$ref" => Decidim::RestFull::Core::DefinitionRegistry.reference(:password_grant_login) }
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:health) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "Health Status",
|
|
7
|
+
description: "Simple health payload with `message` of `OK` or `ERROR`.",
|
|
8
|
+
properties: {
|
|
9
|
+
message: { type: :string, enum: %w(OK ERROR), description: "Overall health flag" }
|
|
10
|
+
}
|
|
11
|
+
}.freeze
|
|
12
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Decidim::RestFull::Core::DefinitionRegistry.register_object(:introspect_data) do
|
|
4
|
+
{
|
|
5
|
+
type: :object,
|
|
6
|
+
title: "Introspection Response",
|
|
7
|
+
properties: {
|
|
8
|
+
sub: {
|
|
9
|
+
type: :integer,
|
|
10
|
+
description: "Access token id"
|
|
11
|
+
},
|
|
12
|
+
active: {
|
|
13
|
+
type: :boolean,
|
|
14
|
+
description: "If the token can be used"
|
|
15
|
+
},
|
|
16
|
+
aud: {
|
|
17
|
+
type: :string,
|
|
18
|
+
description: "Where this token can be used (organization host)"
|
|
19
|
+
},
|
|
20
|
+
resource: {
|
|
21
|
+
type: :object,
|
|
22
|
+
title: "Resource details",
|
|
23
|
+
properties: {
|
|
24
|
+
id: {
|
|
25
|
+
type: :string,
|
|
26
|
+
description: "Resource id"
|
|
27
|
+
},
|
|
28
|
+
type: {
|
|
29
|
+
type: :string,
|
|
30
|
+
enum: ["user"],
|
|
31
|
+
description: "Resource type"
|
|
32
|
+
},
|
|
33
|
+
attributes: {
|
|
34
|
+
type: :object,
|
|
35
|
+
title: "Resource Attributes",
|
|
36
|
+
properties: {
|
|
37
|
+
email: {
|
|
38
|
+
type: :string,
|
|
39
|
+
description: "Email"
|
|
40
|
+
},
|
|
41
|
+
updated_at: {
|
|
42
|
+
type: :string,
|
|
43
|
+
description: "Last update date"
|
|
44
|
+
},
|
|
45
|
+
created_at: {
|
|
46
|
+
type: :string,
|
|
47
|
+
description: "Creation date"
|
|
48
|
+
},
|
|
49
|
+
personal_url: {
|
|
50
|
+
type: :string,
|
|
51
|
+
description: "Personal url (social link, website, etc.)"
|
|
52
|
+
},
|
|
53
|
+
locale: {
|
|
54
|
+
type: :string,
|
|
55
|
+
description: "Current preferred locale",
|
|
56
|
+
enum: Decidim.available_locales
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
required: [:email, :created_at, :updated_at]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
required: [:id, :type]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
required: [:sub, :active, :aud, :exp]
|
|
66
|
+
}.freeze
|
|
67
|
+
end
|