Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify versions #141

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .idea/codeStyles/Project.xml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe don't commit this? does not seem to be necessary to be tracked continously

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IntelliJ removed this thing automatically for ~1year no at my installation.
While I commited it accidentally, I'm also sick of ignoring this change

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ object DefaultSchemaGeneratorHooks : SchemaGeneratorHooks {
}.build()
codeRegistry.dataFetcher(
FieldCoordinates.coordinates(payloadType, fieldName),
DataFetcher { it.getSource<PayloadWrapper>().payload })
DataFetcher { it.getSource<PayloadWrapper>()!!.payload })
fieldDefinition.transform { it.type(GraphQLNonNull(payloadType)) }
} else {
super.didGenerateMutationField(kClass, function, fieldDefinition)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,40 +253,6 @@ class ArchitectureMutations(
return DeleteNodePayload(input.id)
}

@GraphQLDescription(
"""Updates the specified Interface,
requires ADMIN on the Component of the ComponentVersion of the InterfaceDefinition of the Interface to update
"""
)
@AutoPayloadType("The updated Interface ")
suspend fun updateInterface(
@GraphQLDescription("Defines which Interface to update and how to update it")
input: UpdateInterfaceInput,
dfe: DataFetchingEnvironment,
@GraphQLIgnore
@Autowired
interfaceService: InterfaceService
): Interface {
return interfaceService.updateInterface(dfe.gropiusAuthorizationContext, input)
}

@GraphQLDescription(
"""Updates the specified InterfaceDefinition,
requires ADMIN on the Component of the ComponentVersion of the InterfaceDefinition to update
"""
)
@AutoPayloadType("The updated InterfaceDefinition ")
suspend fun updateInterfaceDefinition(
@GraphQLDescription("Defines which InterfaceDefinition to update and how to update it")
input: UpdateInterfaceDefinitionInput,
dfe: DataFetchingEnvironment,
@GraphQLIgnore
@Autowired
interfaceDefinitionService: InterfaceDefinitionService
): InterfaceDefinition {
return interfaceDefinitionService.updateInterfaceDefinition(dfe.gropiusAuthorizationContext, input)
}

@GraphQLDescription(
"""Adds an InterfaceSpecificationVersion (in)visible to ComponentVersions,
requires ADMIN on the Component of the ComponentVersion to update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TemplateMutations : Mutation {
}

@GraphQLDescription("Creates a new InterfaceSpecificationTemplate, requires CAN_CREATE_TEMPLATES")
@AutoPayloadType("The created InterfaceTemplate")
@AutoPayloadType("The created InterfaceSpecificationTemplate")
suspend fun createInterfaceSpecificationTemplate(
@GraphQLDescription("Defines the created InterfaceSpecificationTemplate")
input: CreateInterfaceSpecificationTemplateInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ package gropius.dto.input.architecture

import com.expediagroup.graphql.generator.annotations.GraphQLDescription
import gropius.dto.input.common.CreateNamedNodeInput
import gropius.dto.input.common.Input
import gropius.dto.input.common.JSONFieldInput
import gropius.dto.input.common.validateAndEnsureNoDuplicates
import gropius.dto.input.template.CreateTemplatedNodeInput
import kotlin.properties.Delegates

@GraphQLDescription("Input to create a ComponentVersion")
open class ComponentVersionInput : CreateNamedNodeInput(), CreateTemplatedNodeInput {
open class ComponentVersionInput : Input(), CreateTemplatedNodeInput {

@GraphQLDescription("The version of the created ComponentVersion")
var version: String by Delegates.notNull()

@GraphQLDescription("The tags of the created ComponentVersion")
var tags: List<String> by Delegates.notNull()

@GraphQLDescription("Initial values for all templatedFields")
override var templatedFields: List<JSONFieldInput> by Delegates.notNull()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package gropius.dto.input.architecture

import com.expediagroup.graphql.generator.annotations.GraphQLDescription
import com.expediagroup.graphql.generator.execution.OptionalInput
import gropius.dto.input.common.CreateNamedNodeInput
import gropius.dto.input.common.Input
import gropius.dto.input.common.JSONFieldInput
import gropius.dto.input.common.validateAndEnsureNoDuplicates
Expand All @@ -11,7 +10,7 @@ import gropius.dto.input.template.CreateTemplatedNodeInput
import kotlin.properties.Delegates

@GraphQLDescription("Input to create an InterfaceSpecificationVersion")
open class InterfaceSpecificationVersionInput : CreateNamedNodeInput(), CreateTemplatedNodeInput {
open class InterfaceSpecificationVersionInput : Input(), CreateTemplatedNodeInput {

@GraphQLDescription("Initial values for all templatedFields")
override var templatedFields: List<JSONFieldInput> by Delegates.notNull()
Expand All @@ -22,6 +21,9 @@ open class InterfaceSpecificationVersionInput : CreateNamedNodeInput(), CreateTe
@GraphQLDescription("The version of the created InterfaceSpecificationVersion")
var version: String by Delegates.notNull()

@GraphQLDescription("The tags of the created InterfaceSpecificationVersion")
var tags: List<String> by Delegates.notNull()

override fun validate() {
super.validate()
templatedFields.validateAndEnsureNoDuplicates()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.expediagroup.graphql.generator.annotations.GraphQLDescription
import com.expediagroup.graphql.generator.execution.OptionalInput
import gropius.dto.input.common.JSONFieldInput
import gropius.dto.input.common.UpdateNamedNodeInput
import gropius.dto.input.common.UpdateNodeInput
import gropius.dto.input.common.validateAndEnsureNoDuplicates
import gropius.dto.input.ifPresent
import gropius.dto.input.template.UpdateTemplatedNodeInput
Expand All @@ -12,9 +13,11 @@ import gropius.dto.input.template.UpdateTemplatedNodeInput
class UpdateComponentVersionInput(
@GraphQLDescription("New version of the ComponentVersion")
val version: OptionalInput<String>,
@GraphQLDescription("New tags of the ComponentVersion")
val tags: OptionalInput<List<String>>,
@GraphQLDescription("Values for templatedFields to update")
override val templatedFields: OptionalInput<List<JSONFieldInput>>,
) : UpdateNamedNodeInput(), UpdateTemplatedNodeInput {
) : UpdateNodeInput(), UpdateTemplatedNodeInput {

override fun validate() {
super.validate()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ class UpdateInterfaceSpecificationInput(
"""
)
val interfacePartTemplatedFields: OptionalInput<List<JSONFieldInput>>,
@GraphQLDescription(
"""Values for templatedFields of InterfaceDefinitions to update.
Only evaluated if `template` is provided!
Affect all InterfaceDefinitions of the updated InterfaceSpecification
"""
)
val interfaceDefinitionTemplatedFields: OptionalInput<List<JSONFieldInput>>,
@GraphQLDescription(
"""Values for templatedFields of Interfaces to update.
Only evaluated if `template` is provided!
Affect all Interfaces of the updated InterfaceSpecification
"""
)
val interfaceTemplatedFields: OptionalInput<List<JSONFieldInput>>
) : UpdateNamedNodeInput(), UpdateTemplatedNodeInput {

override fun validate() {
Expand All @@ -61,11 +47,5 @@ class UpdateInterfaceSpecificationInput(
interfacePartTemplatedFields.ifPresent {
it.validateAndEnsureNoDuplicates()
}
interfaceDefinitionTemplatedFields.ifPresent {
it.validateAndEnsureNoDuplicates()
}
interfaceTemplatedFields.ifPresent {
it.validateAndEnsureNoDuplicates()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package gropius.dto.input.architecture

import com.expediagroup.graphql.generator.annotations.GraphQLDescription
import com.expediagroup.graphql.generator.execution.OptionalInput
import gropius.dto.input.common.JSONFieldInput
import gropius.dto.input.common.UpdateNamedNodeInput
import gropius.dto.input.common.validateAndEnsureNoDuplicates
import gropius.dto.input.common.*
import gropius.dto.input.ifPresent
import gropius.dto.input.template.UpdateTemplatedNodeInput

Expand All @@ -13,8 +11,10 @@ class UpdateInterfaceSpecificationVersionInput(
@GraphQLDescription("Values for templatedFields to update")
override val templatedFields: OptionalInput<List<JSONFieldInput>>,
@GraphQLDescription("New version of the InterfaceSpecificationVersion")
val version: OptionalInput<String>
) : UpdateNamedNodeInput(), UpdateTemplatedNodeInput {
val version: OptionalInput<String>,
@GraphQLDescription("New tags of the InterfaceSpecificationVersion")
val tags: OptionalInput<List<String>>,
) : UpdateNodeInput(), UpdateTemplatedNodeInput {

override fun validate() {
super.validate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@ class CreateInterfaceSpecificationTemplateInput(
@GraphQLDescription("SubTemplate for all InterfaceSpecificationVersions of a InterfaceSpecification with the created Template")
val interfaceSpecificationVersionTemplate: SubTemplateInput,
@GraphQLDescription("SubTemplate for all InterfaceParts of a InterfaceSpecification with the created Template")
val interfacePartTemplate: SubTemplateInput,
@GraphQLDescription("SubTemplate for all Interfaces of a InterfaceSpecification with the created Template")
val interfaceTemplate: NullableSubTemplateInput,
@GraphQLDescription("SubTemplate for all InterfacesDefinitions of a InterfaceSpecification with the created Template")
val interfaceDefinitionTemplate: NullableSubTemplateInput,
val interfacePartTemplate: SubTemplateInput
) : CreateRelationPartnerTemplateInput() {

override fun validate() {
super.validate()
interfaceSpecificationVersionTemplate.validate()
interfacePartTemplate.validate()
interfaceTemplate.validate()
interfaceDefinitionTemplate.validate()
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gropius.model.architecture

import com.expediagroup.graphql.generator.annotations.GraphQLDescription
import gropius.model.common.NamedNode
import gropius.model.common.BaseNode
import gropius.model.issue.Issue
import io.github.graphglue.model.*

Expand All @@ -17,7 +17,7 @@ const val RELATED_TO_FILTER_BEAN = "relatedToFilter"
"""
)
@AdditionalFilter(RELATED_TO_FILTER_BEAN)
abstract class AffectedByIssue(name: String, description: String) : NamedNode(name, description) {
abstract class AffectedByIssue : BaseNode() {

@NodeRelationship(Issue.AFFECTS, Direction.INCOMING)
@GraphQLDescription("The issues which affect this entity")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ import org.springframework.data.neo4j.core.schema.CompositeProperty
@Authorization(TrackablePermission.RELATED_ISSUE_AFFECTED_ENTITY, allowFromRelated = ["component"])
@Authorization(ProjectPermission.PART_OF_PROJECT, allowFromRelated = ["includingProjects"])
class ComponentVersion(
name: String,
description: String,
@property:GraphQLDescription("The version of this ComponentVersion")
@FilterProperty
@SearchProperty
@OrderProperty
override var version: String,
@property:GraphQLDescription("The tags of this ComponentVersion")
@SearchProperty
override var tags: List<String>,
@property:GraphQLIgnore
@CompositeProperty
override val templatedFields: MutableMap<String, String>
) : RelationPartner(name, description), Versioned, MutableTemplatedNode {
) : RelationPartner(), Versioned, MutableTemplatedNode {

companion object {
const val INTRA_COMPONENT_DEPENDENCY_SPECIFICATION = "INTRA_COMPONENT_DEPENDENCY_SPECIFICATION"
Expand Down
20 changes: 2 additions & 18 deletions core/src/main/kotlin/gropius/model/architecture/Interface.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@ package gropius.model.architecture

import com.expediagroup.graphql.generator.annotations.GraphQLDescription
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
import gropius.model.template.BaseTemplate
import gropius.model.template.InterfaceTemplate
import gropius.model.template.MutableTemplatedNode
import gropius.model.template.RelationPartnerTemplate
import gropius.model.user.permission.ComponentPermission
import gropius.model.user.permission.NodePermission
import gropius.model.user.permission.ProjectPermission
import gropius.model.user.permission.TrackablePermission
import io.github.graphglue.model.*
import io.github.graphglue.model.property.NodeCache
import org.springframework.data.neo4j.core.schema.CompositeProperty

@DomainNode(searchQueryName = "searchInterfaces")
@DomainNode
@GraphQLDescription(
"""An interface which is part of a specific ComponentVersion.
Its semantics depend on the InterfaceSpecification it is specified by, e.g. an Interface can represent a REST API.
Expand All @@ -28,24 +24,12 @@ import org.springframework.data.neo4j.core.schema.CompositeProperty
@Authorization(TrackablePermission.AFFECT_ENTITIES_WITH_ISSUES, allowFromRelated = ["interfaceDefinition"])
@Authorization(TrackablePermission.RELATED_ISSUE_AFFECTED_ENTITY, allowFromRelated = ["interfaceDefinition"])
@Authorization(ProjectPermission.PART_OF_PROJECT, allowFromRelated = ["interfaceDefinition"])
class Interface(
name: String,
description: String,
@property:GraphQLIgnore
@CompositeProperty
override val templatedFields: MutableMap<String, String>
) : RelationPartner(name, description), MutableTemplatedNode {
class Interface : RelationPartner() {

companion object {
const val DEFINITION = "DEFINITION"
}

@NodeRelationship(BaseTemplate.USED_IN, Direction.INCOMING)
@GraphQLDescription("The Template of this Interface.")
@FilterProperty
@OrderProperty
override val template by NodeProperty<InterfaceTemplate>()

@NodeRelationship(DEFINITION, Direction.OUTGOING)
@GraphQLDescription("The definition of this interface.")
@FilterProperty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
package gropius.model.architecture

import com.expediagroup.graphql.generator.annotations.GraphQLDescription
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
import gropius.model.common.BaseNode
import gropius.model.template.BaseTemplate
import gropius.model.template.InterfaceDefinitionTemplate
import gropius.model.template.MutableTemplatedNode
import gropius.model.user.permission.ComponentPermission
import gropius.model.user.permission.NodePermission
import gropius.model.user.permission.ProjectPermission
import gropius.model.user.permission.TrackablePermission
import io.github.graphglue.model.*
import org.springframework.data.neo4j.core.schema.CompositeProperty

@DomainNode
@GraphQLDescription(
Expand Down Expand Up @@ -40,10 +35,7 @@ class InterfaceDefinition(
@FilterProperty
@OrderProperty
var invisibleSelfDefined: Boolean,
@property:GraphQLIgnore
@CompositeProperty
override val templatedFields: MutableMap<String, String>
) : BaseNode(), MutableTemplatedNode {
) : BaseNode() {

companion object {
const val VISIBLE_DERIVED_BY = "VISIBLE_DERIVED_BY"
Expand All @@ -52,12 +44,6 @@ class InterfaceDefinition(
const val COMPONENT_VERSION = "COMPONENT_VERSION"
}

@NodeRelationship(BaseTemplate.USED_IN, Direction.INCOMING)
@GraphQLDescription("The Template of this InterfaceDefinition.")
@FilterProperty
@OrderProperty
override val template by NodeProperty<InterfaceDefinitionTemplate>()

@NodeRelationship(INTERFACE_SPECIFICATION_VERSION, Direction.OUTGOING)
@GraphQLDescription("The InterfaceSpecificationVersion present on the ComponentVersion")
@FilterProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class InterfacePart(
@property:GraphQLIgnore
@CompositeProperty
override val templatedFields: MutableMap<String, String>
) : AffectedByIssue(name, description), MutableTemplatedNode {
) : NamedAffectedByIssue(name, description), MutableTemplatedNode {

@NodeRelationship(BaseTemplate.USED_IN, Direction.INCOMING)
@GraphQLDescription("The Template of this InterfacePart")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import org.springframework.data.neo4j.core.schema.CompositeProperty
@Authorization(NodePermission.READ, allowFromRelated = ["component", "versions"])
@Authorization(NodePermission.ADMIN, allowFromRelated = ["component"])
@Authorization(TrackablePermission.AFFECT_ENTITIES_WITH_ISSUES, allowFromRelated = ["component"])
@Authorization(TrackablePermission.RELATED_ISSUE_AFFECTED_ENTITY, allowFromRelated = ["versions"])
@Authorization(TrackablePermission.RELATED_ISSUE_AFFECTED_ENTITY, allowFromRelated = ["versions", "component"])
class InterfaceSpecification(
name: String,
description: String,
@property:GraphQLIgnore
@CompositeProperty
override val templatedFields: MutableMap<String, String>
) : AffectedByIssue(
) : NamedAffectedByIssue(
name, description
), MutableTemplatedNode {

Expand Down
Loading