diff options
Diffstat (limited to 'app/graphql/types/packages')
-rw-r--r-- | app/graphql/types/packages/file_metadata_type.rb | 5 | ||||
-rw-r--r-- | app/graphql/types/packages/helm/dependency_type.rb | 28 | ||||
-rw-r--r-- | app/graphql/types/packages/helm/file_metadatum_type.rb | 19 | ||||
-rw-r--r-- | app/graphql/types/packages/helm/maintainer_type.rb | 18 | ||||
-rw-r--r-- | app/graphql/types/packages/helm/metadata_type.rb | 32 | ||||
-rw-r--r-- | app/graphql/types/packages/package_file_type.rb | 2 |
6 files changed, 103 insertions, 1 deletions
diff --git a/app/graphql/types/packages/file_metadata_type.rb b/app/graphql/types/packages/file_metadata_type.rb index 46ccb424218..0731fc897a2 100644 --- a/app/graphql/types/packages/file_metadata_type.rb +++ b/app/graphql/types/packages/file_metadata_type.rb @@ -14,6 +14,8 @@ module Types case object when ::Packages::Conan::FileMetadatum ::Types::Packages::Conan::FileMetadatumType + when ::Packages::Helm::FileMetadatum + ::Types::Packages::Helm::FileMetadatumType else # NOTE: This method must be kept in sync with `PackageFileType#file_metadata`, # which must never produce data that this discriminator cannot handle. @@ -21,7 +23,8 @@ module Types end end - orphan_types Types::Packages::Conan::FileMetadatumType + orphan_types Types::Packages::Conan::FileMetadatumType, + Types::Packages::Helm::FileMetadatumType end end end diff --git a/app/graphql/types/packages/helm/dependency_type.rb b/app/graphql/types/packages/helm/dependency_type.rb new file mode 100644 index 00000000000..35598c2b1d7 --- /dev/null +++ b/app/graphql/types/packages/helm/dependency_type.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Types + module Packages + module Helm + # rubocop: disable Graphql/AuthorizeTypes + class DependencyType < BaseObject + graphql_name 'PackageHelmDependencyType' + description 'Represents a Helm dependency' + + # Need to be synced with app/validators/json_schemas/helm_metadata.json#dependencies + field :name, GraphQL::Types::String, null: true, description: 'Name of the dependency.' + field :version, GraphQL::Types::String, null: true, description: 'Version of the dependency.' + field :repository, GraphQL::Types::String, null: true, description: 'Repository of the dependency.' + field :condition, GraphQL::Types::String, null: true, description: 'Condition of the dependency.' + field :tags, [GraphQL::Types::String], null: true, description: 'Tags of the dependency.' + field :enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates the dependency is enabled.' + field :import_values, [GraphQL::Types::JSON], null: true, description: 'Import-values of the dependency.', hash_key: "import-values" # rubocop:disable Graphql/JSONType + field :alias, GraphQL::Types::String, null: true, description: 'Alias of the dependency.', resolver_method: :resolve_alias + + # field :alias` conflicts with a built-in method + def resolve_alias + object['alias'] + end + end + end + end +end diff --git a/app/graphql/types/packages/helm/file_metadatum_type.rb b/app/graphql/types/packages/helm/file_metadatum_type.rb new file mode 100644 index 00000000000..734ed52df40 --- /dev/null +++ b/app/graphql/types/packages/helm/file_metadatum_type.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Types + module Packages + module Helm + class FileMetadatumType < BaseObject + graphql_name 'HelmFileMetadata' + description 'Helm file metadata' + + implements Types::Packages::FileMetadataType + + authorize :read_package + + field :channel, GraphQL::Types::String, null: false, description: 'Channel of the Helm chart.' + field :metadata, Types::Packages::Helm::MetadataType, null: false, description: 'Metadata of the Helm chart.' + end + end + end +end diff --git a/app/graphql/types/packages/helm/maintainer_type.rb b/app/graphql/types/packages/helm/maintainer_type.rb new file mode 100644 index 00000000000..6d25a26c46b --- /dev/null +++ b/app/graphql/types/packages/helm/maintainer_type.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Types + module Packages + module Helm + # rubocop: disable Graphql/AuthorizeTypes + class MaintainerType < BaseObject + graphql_name 'PackageHelmMaintainerType' + description 'Represents a Helm maintainer' + + # Need to be synced with app/validators/json_schemas/helm_metadata.json#maintainers + field :name, GraphQL::Types::String, null: true, description: 'Name of the maintainer.' + field :email, GraphQL::Types::String, null: true, description: 'Email of the maintainer.' + field :url, GraphQL::Types::String, null: true, description: 'URL of the maintainer.' + end + end + end +end diff --git a/app/graphql/types/packages/helm/metadata_type.rb b/app/graphql/types/packages/helm/metadata_type.rb new file mode 100644 index 00000000000..eeb3e8087a8 --- /dev/null +++ b/app/graphql/types/packages/helm/metadata_type.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Types + module Packages + module Helm + # rubocop: disable Graphql/AuthorizeTypes + class MetadataType < BaseObject + graphql_name 'PackageHelmMetadataType' + description 'Represents the contents of a Helm Chart.yml file' + + # Need to be synced with app/validators/json_schemas/helm_metadata.json + field :name, GraphQL::Types::String, null: false, description: 'Name of the chart.' + field :home, GraphQL::Types::String, null: true, description: 'URL of the home page.' + field :sources, [GraphQL::Types::String], null: true, description: 'URLs of the source code for the chart.' + field :version, GraphQL::Types::String, null: false, description: 'Version of the chart.' + field :description, GraphQL::Types::String, null: true, description: 'Description of the chart.' + field :keywords, [GraphQL::Types::String], null: true, description: 'Keywords for the chart.' + field :maintainers, [Types::Packages::Helm::MaintainerType], null: true, description: 'Maintainers of the chart.' + field :icon, GraphQL::Types::String, null: true, description: 'URL to an SVG or PNG image for the chart.' + field :api_version, GraphQL::Types::String, null: false, description: 'API version of the chart.', hash_key: "apiVersion" + field :condition, GraphQL::Types::String, null: true, description: 'Condition for the chart.' + field :tags, GraphQL::Types::String, null: true, description: 'Tags for the chart.' + field :app_version, GraphQL::Types::String, null: true, description: 'App version of the chart.', hash_key: "appVersion" + field :deprecated, GraphQL::Types::Boolean, null: true, description: 'Indicates if the chart is deprecated.' + field :annotations, GraphQL::Types::JSON, null: true, description: 'Annotations for the chart.' # rubocop:disable Graphql/JSONType + field :kube_version, GraphQL::Types::String, null: true, description: 'Kubernetes versions for the chart.', hash_key: "kubeVersion" + field :dependencies, [Types::Packages::Helm::DependencyType], null: true, description: 'Dependencies of the chart.' + field :type, GraphQL::Types::String, null: true, description: 'Type of the chart.', hash_key: "appVersion" + end + end + end +end diff --git a/app/graphql/types/packages/package_file_type.rb b/app/graphql/types/packages/package_file_type.rb index 8cc0f9b984a..f90a0992bf8 100644 --- a/app/graphql/types/packages/package_file_type.rb +++ b/app/graphql/types/packages/package_file_type.rb @@ -27,6 +27,8 @@ module Types case object.package.package_type when 'conan' object.conan_file_metadatum + when 'helm' + object.helm_file_metadatum else nil end |