Пример #1
0
// MarshalJSON marshals this swagger structure to json
func (s Swagger) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(s.swaggerProps)
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(schemaJSONBytes, b1), nil
}
Пример #2
0
// MarshalJSON marshal this to JSON
func (s Schema) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(s.SchemaProps)
	if err != nil {
		return nil, fmt.Errorf("schema props %v", err)
	}
	b2, err := json.Marshal(s.VendorExtensible)
	if err != nil {
		return nil, fmt.Errorf("vendor props %v", err)
	}
	b3, err := s.Ref.MarshalJSON()
	if err != nil {
		return nil, fmt.Errorf("ref prop %v", err)
	}
	b4, err := s.Schema.MarshalJSON()
	if err != nil {
		return nil, fmt.Errorf("schema prop %v", err)
	}
	b5, err := json.Marshal(s.SwaggerSchemaProps)
	if err != nil {
		return nil, fmt.Errorf("common validations %v", err)
	}
	var b6 []byte
	if s.ExtraProps != nil {
		jj, err := json.Marshal(s.ExtraProps)
		if err != nil {
			return nil, fmt.Errorf("extra props %v", err)
		}
		b6 = jj
	}
	return swag.ConcatJSON(b1, b2, b3, b4, b5, b6), nil
}
Пример #3
0
// MarshalJSON marshals this swagger structure to json
func (s Swagger) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(s.SwaggerProps)
	if err != nil {
		return nil, err
	}
	b2, err := json.Marshal(s.VendorExtensible)
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(b1, b2), nil
}
Пример #4
0
Файл: tag.go Проект: vmware/vic
// MarshalJSON marshal this to JSON
func (t Tag) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(t.tagProps)
	if err != nil {
		return nil, err
	}
	b2, err := json.Marshal(t.VendorExtensible)
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(b1, b2), nil
}
Пример #5
0
// MarshalJSON marshal this to JSON
func (s SecurityScheme) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(s.securitySchemeProps)
	if err != nil {
		return nil, err
	}
	b2, err := json.Marshal(s.vendorExtensible)
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(b1, b2), nil
}
Пример #6
0
// MarshalJSON converts this items object to JSON
func (r Response) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(r.responseProps)
	if err != nil {
		return nil, err
	}
	b2, err := json.Marshal(r.refable)
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(b1, b2), nil
}
Пример #7
0
// MarshalJSON marshal this to JSON
func (i Info) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(i.infoProps)
	if err != nil {
		return nil, err
	}
	b2, err := json.Marshal(i.vendorExtensible)
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(b1, b2), nil
}
Пример #8
0
// MarshalJSON converts this items object to JSON
func (o Operation) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(o.operationProps)
	if err != nil {
		return nil, err
	}
	b2, err := json.Marshal(o.vendorExtensible)
	if err != nil {
		return nil, err
	}
	concated := swag.ConcatJSON(b1, b2)
	return concated, nil
}
Пример #9
0
// MarshalJSON converts this items object to JSON
func (r Responses) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(r.responsesProps)
	if err != nil {
		return nil, err
	}
	b2, err := json.Marshal(r.vendorExtensible)
	if err != nil {
		return nil, err
	}
	concated := swag.ConcatJSON(b1, b2)
	return concated, nil
}
Пример #10
0
// MarshalJSON converts this items object to JSON
func (i Items) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(i.commonValidations)
	if err != nil {
		return nil, err
	}
	b2, err := json.Marshal(i.simpleSchema)
	if err != nil {
		return nil, err
	}
	b3, err := json.Marshal(i.refable)
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(b3, b1, b2), nil
}
Пример #11
0
// MarshalJSON marshal this to JSON
func (h Header) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(h.CommonValidations)
	if err != nil {
		return nil, err
	}
	b2, err := json.Marshal(h.SimpleSchema)
	if err != nil {
		return nil, err
	}
	b3, err := json.Marshal(h.HeaderProps)
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(b1, b2, b3), nil
}
Пример #12
0
// MarshalJSON converts this items object to JSON
func (p PathItem) MarshalJSON() ([]byte, error) {
	b3, err := json.Marshal(p.Refable)
	if err != nil {
		return nil, err
	}
	b4, err := json.Marshal(p.VendorExtensible)
	if err != nil {
		return nil, err
	}
	b5, err := json.Marshal(p.pathItemProps)
	if err != nil {
		return nil, err
	}
	concated := swag.ConcatJSON(b3, b4, b5)
	return concated, nil
}
Пример #13
0
// MarshalJSON converts this items object to JSON
func (p Paths) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(p.VendorExtensible)
	if err != nil {
		return nil, err
	}

	pths := make(map[string]PathItem)
	for k, v := range p.Paths {
		if strings.HasPrefix(k, "/") {
			pths[k] = v
		}
	}
	b2, err := json.Marshal(pths)
	if err != nil {
		return nil, err
	}
	concated := swag.ConcatJSON(b1, b2)
	return concated, nil
}
Пример #14
0
// MarshalJSON converts this items object to JSON
func (p Parameter) MarshalJSON() ([]byte, error) {
	b1, err := json.Marshal(p.commonValidations)
	if err != nil {
		return nil, err
	}
	b2, err := json.Marshal(p.simpleSchema)
	if err != nil {
		return nil, err
	}
	b3, err := json.Marshal(p.refable)
	if err != nil {
		return nil, err
	}
	b4, err := json.Marshal(p.vendorExtensible)
	if err != nil {
		return nil, err
	}
	b5, err := json.Marshal(p.paramProps)
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(b3, b1, b2, b4, b5), nil
}
Пример #15
0
// MarshalJSON marshals this object with a polymorphic type to a JSON structure
func (m ProductRatePlan) MarshalJSON() ([]byte, error) {
	var b1, b2 []byte
	var err error
	b1, err = json.Marshal(struct {
		AggregatingComponents []*AggregatingComponent `json:"aggregatingComponents,omitempty"`

		BillingEntity *string `json:"billingEntity,omitempty"`

		ChangedBy *string `json:"changedBy,omitempty"`

		CreateZeroValuedInvoices bool `json:"createZeroValuedInvoices,omitempty"`

		Created strfmt.DateTime `json:"created,omitempty"`

		Crmid *string `json:"crmid,omitempty"`

		Currency string `json:"currency,omitempty"`

		DisplayName *string `json:"displayName,omitempty"`

		Duration int32 `json:"duration,omitempty"`

		DurationPeriod string `json:"durationPeriod,omitempty"`

		FailedPaymentBehaviour string `json:"failedPaymentBehaviour,omitempty"`

		FixedTermDefinitions []*MutableBillingEntity `json:"fixedTermDefinitions,omitempty"`

		ID *string `json:"id,omitempty"`

		InvoiceIssueType *string `json:"invoiceIssueType,omitempty"`

		IssueDuration int32 `json:"issueDuration,omitempty"`

		IssuePeriod *string `json:"issuePeriod,omitempty"`

		LocalisedTax bool `json:"localisedTax,omitempty"`

		MigrationBehaviour string `json:"migrationBehaviour,omitempty"`

		Name string `json:"name,omitempty"`

		NotificationObjectGraph *string `json:"notificationObjectGraph,omitempty"`

		ProRataMode string `json:"proRataMode,omitempty"`

		Product *Product `json:"product,omitempty"`

		ProductID string `json:"productID,omitempty"`

		ProductType *string `json:"productType,omitempty"`

		PublicName *string `json:"publicName,omitempty"`

		RecursionType *string `json:"recursionType,omitempty"`

		Status *string `json:"status,omitempty"`

		TaxStatus string `json:"taxStatus,omitempty"`

		Taxation []*MutableBillingEntity `json:"taxation,omitempty"`

		Trial int32 `json:"trial,omitempty"`

		TrialPeriod *string `json:"trialPeriod,omitempty"`

		Updated strfmt.DateTime `json:"updated,omitempty"`

		ValidFrom strfmt.DateTime `json:"validFrom,omitempty"`

		ValidTill strfmt.DateTime `json:"validTill,omitempty"`
	}{
		AggregatingComponents:    m.AggregatingComponents,
		BillingEntity:            m.BillingEntity,
		ChangedBy:                m.ChangedBy,
		CreateZeroValuedInvoices: m.CreateZeroValuedInvoices,
		Created:                  m.Created,
		Crmid:                    m.Crmid,
		Currency:                 m.Currency,
		DisplayName:              m.DisplayName,
		Duration:                 m.Duration,
		DurationPeriod:           m.DurationPeriod,
		FailedPaymentBehaviour:   m.FailedPaymentBehaviour,
		FixedTermDefinitions:     m.FixedTermDefinitions,
		ID:                       m.ID,
		InvoiceIssueType:         m.InvoiceIssueType,
		IssueDuration:            m.IssueDuration,
		IssuePeriod:              m.IssuePeriod,
		LocalisedTax:             m.LocalisedTax,
		MigrationBehaviour:       m.MigrationBehaviour,
		Name:                     m.Name,
		NotificationObjectGraph: m.NotificationObjectGraph,
		ProRataMode:             m.ProRataMode,
		Product:                 m.Product,
		ProductID:               m.ProductID,
		ProductType:             m.ProductType,
		PublicName:              m.PublicName,
		RecursionType:           m.RecursionType,
		Status:                  m.Status,
		TaxStatus:               m.TaxStatus,
		Taxation:                m.Taxation,
		Trial:                   m.Trial,
		TrialPeriod:             m.TrialPeriod,
		Updated:                 m.Updated,
		ValidFrom:               m.ValidFrom,
		ValidTill:               m.ValidTill,
	})
	if err != nil {
		return nil, err
	}
	b2, err = json.Marshal(struct {
		PricingComponents []PricingComponent `json:"pricingComponents,omitempty"`
	}{
		PricingComponents: m.PricingComponents,
	})
	if err != nil {
		return nil, err
	}
	return swag.ConcatJSON(b1, b2), nil
}