Skip to content

Commit

Permalink
Merge pull request #11 from wonderflow/head
Browse files Browse the repository at this point in the history
make httpGet header optianal
  • Loading branch information
wonderflow authored Jan 2, 2020
2 parents ddaea52 + 3e3cda2 commit b22c640
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions api/v1alpha1/applicationconfiguration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ func (c *ComponentConfiguration) ExistTrait(t string) bool {
// Get specific trait's Full name of this component and its parameterValues.
// If not exist, name is "" and parameterValues is nil.
// bool mark whether this trait has ref name.
func (c *ComponentConfiguration) ExtractTrait(t string) (string, bool, []ParameterValue) {
var pvals []ParameterValue
func (c *ComponentConfiguration) ExtractTrait(t string) (string, bool, map[string]interface{}) {
var pvals map[string]interface{}
name := ""
existing := c.Traits
isRef := false
Expand All @@ -222,8 +222,8 @@ func (c *ComponentConfiguration) ExtractTrait(t string) (string, bool, []Paramet
return name, isRef, pvals
}

func parseParamValues(data []byte) []ParameterValue {
pvals := make([]ParameterValue, 0)
func parseParamValues(data []byte) map[string]interface{} {
pvals := make(map[string]interface{})
err := json.Unmarshal(data, &pvals)
if err != nil {
panic("json Unmarshal failed")
Expand Down
8 changes: 5 additions & 3 deletions api/v1alpha1/component_schematic_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ type HttpHeader struct {
}

type HttpGet struct {
Path string `json:"path"`
Port int32 `json:"port"`
Path string `json:"path"`
Port int32 `json:"port"`
// +optional
HttpHeaders []HttpHeader `json:"httpHeaders"`
}

Expand Down Expand Up @@ -235,7 +236,8 @@ type Expose struct {

type Consume struct {
Name string `json:"name"`
As string `json:"as"`
// +optional
As string `json:"as"`
}

// ComponentSpec defines the desired state of ComponentSchematic
Expand Down
3 changes: 0 additions & 3 deletions config/crd/bases/core.oam.dev_componentschematics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ spec:
name:
type: string
required:
- as
- name
type: object
type: array
Expand Down Expand Up @@ -130,7 +129,6 @@ spec:
format: int32
type: integer
required:
- httpHeaders
- path
- port
type: object
Expand Down Expand Up @@ -211,7 +209,6 @@ spec:
format: int32
type: integer
required:
- httpHeaders
- path
- port
type: object
Expand Down

0 comments on commit b22c640

Please sign in to comment.