Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 26 15:42
    jypma commented #556
  • Feb 26 15:42
    jypma commented #556
  • Feb 26 06:55
    etitov commented #558
  • Feb 26 06:55
    etitov commented #558
  • Feb 26 06:42
    etitov opened #558
  • Feb 26 06:42
    etitov opened #558
  • Feb 25 13:38
    kalejami commented #557
  • Feb 25 13:38
    kalejami commented #557
  • Feb 25 13:25
    kalejami opened #557
  • Feb 25 13:25
    kalejami opened #557
  • Feb 24 05:25
    etitov commented #318
  • Feb 24 05:25
    etitov commented #318
  • Feb 23 15:58

    eed3si9n on master

    Trim most XSD types that have w… Merge pull request #556 from jy… (compare)

  • Feb 23 15:58

    eed3si9n on master

    Trim most XSD types that have w… Merge pull request #556 from jy… (compare)

  • Feb 23 15:58
    eed3si9n closed #556
  • Feb 23 15:58
    eed3si9n closed #556
  • Feb 23 15:58
    eed3si9n closed #554
  • Feb 23 15:58
    eed3si9n closed #554
  • Feb 23 14:22
    jypma commented #556
  • Feb 23 14:22
    jypma commented #556
eugene yokota
@eed3si9n
@deenar doesn't implicit class ItemsW handle that compositional case?
Deenar Toraskar
@deenar
i hadn't noticed it, how do you see it being used?
forgive my ignorance
Deenar Toraskar
@deenar
can you give some examples?
Deenar Toraskar
@deenar
@eed3si9n I was using implicit class, i have a couple of questions - in cases where there is a choice, which is typically represented by scalaxb should there be an Optional lens?
say if an Identifier - was ISIN, CUSIP or SEDOL
so an at or index to zoom into a specific choice?
2) what was the reason for generating lens and not an optional for Option attributes?
eugene yokota
@eed3si9n
in http://scalaxb.org/scalaxb-1.8.0, I used it as PurchaseOrderType.items.item
so instead of dynamically composing, it's doing static monkey patching against Lens[A, Items]
the lack of completeness in Lens generation was mostly out of laziness. I implemented the PR in a few hours in the morning mostly by resurrecting an old PR
I figured I can get something minimal out, and if it's useful ppl can build on top of it
eugene yokota
@eed3si9n
you're welcolme to take a look at eed3si9n/scalaxb#535 and send a PRs to improve it
Deenar Toraskar
@deenar
Thanks, I am quite new to this, still trying to find my way around Lenses and scalaxb, but will give it a go.
Deenar Toraskar
@deenar
another question for now, how do you(or can you) traverse a nested schema when there is an Optional field
Deenar Toraskar
@deenar
``` case class Bank(BICFI: Option[String] = None,

Name: Option[String] = None,
PstlAdr: Option[common.PostalAddress] = None)

case class PostalAddress(AdrTp: Option[AddressType2Code] = None,
StrtNm: Option[String] = None,
BldgNb: Option[String] = None,
PstCd: Option[String] = None,
TwnNm: Option[String] = None)

``` 

I can get Bank.PstlAdr, but go no further not sure if I can compose a Lens[Bank,Option[PostalAddress] and a Lens[PostalAddress, Option[AddressType2Code] together

Deenar Toraskar
@deenar
I figured you need a import monocle.std.option._; composePrism(some) to go from Option[A] to A
ouakrim
@Ouakrim
Hello
I am using the sbt scalaxb plugin to consume a web service in SOAP, and I ask if there is a configuration of this plugin to get the wsdl from a remote server ?
i try this but it doesn't work :
scalaxbPackageNames in (Compile, scalaxb) := Map(uri("http://172.17.0.2:8080/castlemock/mock/soap/project/UKt4ew/BookServiceSOAP") -> "com.books")
Deenar Toraskar
@deenar
Hi @eed3si9n I have a very large xsd document. scalaxb generates the source fine, but javac is running out of memory. What options do I have? I see there is a scalaxbContentsSizeLimit. I did a repo search but could find reference to its use.
Deenar Toraskar
@deenar
Hi @eed3si9n I saw an item in the backlog about JSON support. What were you thought about implementing this? I would like to take a stab at doing this?
eugene yokota
@eed3si9n
@deenar I don't think there's much you can do about the size in the current design. it would be good to be able to split the code per schema. for JSON support I use Contraband - https://www.scala-sbt.org/contraband/
Deenar Toraskar
@deenar
thanks, @eed3si9n just to clarify if one wanted to add JSON support to scalaxb, you would look at using Contraband, can you give me some pointers as to where to start? Currently scalaxb isnt using contraband to generate the case classes?
Arsene Tochemey Gandote
@Tochemey
Hello folks. Please I would like to know how best I can use this tool to build soap service. I have gone through the doc but it seems it can only help consume soap service. Forgive me if I am wrong
eugene yokota
@eed3si9n
@Tochemey we haven't implemented the service portion sorry
Arsene Tochemey Gandote
@Tochemey
@eed3si9n Thanks
Deenar Toraskar
@deenar
@eed3si9n I have an application that processes 100s of various incoming message types each of which have their own schema. The schema details are in the header. Is there a way other than using a large case statement to do something like
``` val doc = scalaxb.fromXML[Class.forName("pacs_001_001_02.Document")](xml)    ``` 
eugene yokota
@eed3si9n
@deenar I'm not sure if that would work. the point of typeclass-based databinding is that we know the shape of the document at compile-time. I guess you could generate custom code in the build?
Deenar Toraskar
@deenar
I know the above wouldn't work, code generation is a good idea
Deenar Toraskar
@deenar
@eed3si9n I have submitted a PR to improve Lenses generation, I cannot find where the documentation should be checked in https://scalaxb.org/scalaxb-1.8.0. The notes in the repo seem to go to release 1.5.2
eugene yokota
@eed3si9n
I started using GitHub releases. you can put whatever info on the PR itself I guess
Deenar Toraskar
@deenar
Thanks
Deenar Toraskar
@deenar
All, here is my attempt at enhancing the Lenses generation in scalaxb, comments are welcome. Currently Lens'es are generated for all members of the ADT https://scalaxb.org/scalaxb-1.8.0 . This works fine unless you have Option, List or Map elements. I have changed it such that there is a combination of Lens, Optional optics generated along with index and at functions for Lists and Maps. https://gist.github.com/deenar/642e29a3380565799634d9382dd10771
Deenar Toraskar
@deenar

What am I doing wrong? I have a couple of properties set in built.sbt, they dont seem to have any effect

scalaxbPrependFamily := true
scalaxbNamedAttributes := true

I am also getting the following warnings, other scalaxb properties like scalaxbProtocolPackageName seem to work fine.

[warn] there are 2 keys that are not used by any other settings/tasks:
[warn]  
[warn] * root / scalaxbNamedAttributes
[warn]   +- /Users/deenar/dev/isotoolkit/build.sbt:94
[warn] * root / scalaxbPrependFamily
[warn]   +- /Users/deenar/dev/isotoolkit/build.sbt:99
[warn]
João Ferreira
@jtjeferreira
I think you need to set them on submodules
Deenar Toraskar
@deenar
Thanks @jtjeferreira
Milad Khajavi
@khajavi
Is there any reason that XsTypeSymbol is not defined as sealed trait? All of them are in one compilation unit and if it defined as a sealed trait, we have the benefit of compilation check on patter machings.
@eed3si9n
Milad Khajavi
@khajavi
also BuiltInSimpleTypeSymbol
eugene yokota
@eed3si9n
@khajavi I think it should be. I'm guessing it's not because at some point I was trying to dogfood scalaxb by letting scalaxb generate binding for XML Schema.
Álvaro Castellanos López
@AlvaroCaste

hi! I've seen that on XMLProtocol, targetNamespace is generated as a None defaultScope. In my case, this hampers that a request has been well built.
Let's me explain this with an example. Having this wsdl:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions 
    xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
    xmlns:tns="http://myservice.com/service/login" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:s="http://www.w3.org/2001/XMLSchema"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
    targetNamespace="http://myservice.com/service/login"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://myservice.com/service/login">
      <s:element name="getAuth">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="user" type="s:string" />
            <s:element minOccurs="1" maxOccurs="1" form="unqualified" name="password" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      .
      .
      .

what I get as a request for getAuth is:

<soap11:Envelope 
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:tns="http://myservice.com/service/login"
xmlns="http://myservice.com/service/login">
    <soap11:Body>
        <getAuth>
            <user>user</user>
            <password>password</password>
        </getAuth>
    </soap11:Body>
</soap11:Envelope>

and because <getAuth> doesn't have tns we get:

System.Web.Services.Protocols.SoapException: The element 'getAuth' in namespace 'http://myservice.com/service/login' has invalid child element 'user' in namespace 'http://myservice.com/service/login'. List of possible elements expected: 'user'.

I've realized that removing None -> "http://myservice.com/service/login" from defaultScope

trait XMLProtocol extends scalaxb.XMLStandardTypes {
  val defaultScope = scalaxb.toScope(None -> "http://myservice.com/service/login",
    Some("tns") -> "http://myservice.com/service/login",
    Some("xs") -> "http://www.w3.org/2001/XMLSchema",
    Some("xsi") -> "http://www.w3.org/2001/XMLSchema-instance")
...

this is solved and the request is well built:

<soap11:Envelope 
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://myservice.com/service/login">
    <soap11:Body>
        <tns:getAuth>
            <user>user</user>
            <password>password</password>
        </tns:getAuth>
    </soap11:Body>
</soap11:Envelope>

So, my question is, how can I fix this?

We use sbt-scalaxb 1.8.0, scala 2.13.4 and this is part of my build.sbt

  lazy val scalaXml           = "org.scala-lang.modules"       %% "scala-xml"                % "2.0.0-M2"
  lazy val scalaParser        = "org.scala-lang.modules"       %% "scala-parser-combinators" % "1.1.2"
  lazy val dispatch           = "org.dispatchhttp"             %% "dispatch-core"            % "1.1.3"

...

    .enablePlugins(ScalaxbPlugin)
    .settings(
      scalacOptions ++= Seq("-Wconf:src=src_managed/.*:silent"),
      sourceGenerators in Compile += (scalaxb in Compile).taskValue,
      scalaxbPackageName in (Compile, scalaxb) := "generated",
      scalaxbDispatchVersion in (Compile, scalaxb) := "1.1.3"
    )

Please, let me know if I need to report something else to clarify this. I hope someone can help me. Thanks :)

Jarod Belshaw
@jarod7736
I have <xs:element name="partition" minOccurs="0" maxOccurs="1" type="test_partition_type"> <xs:annotation> <xs:appinfo> <jaxb:property> <jaxb:baseType> <jaxb:javaType name="TestPartitionType" parseMethod="TestPartitionTypeAdapter.decode" printMethod="TestPartitionTypeAdapter.encode" /> </jaxb:baseType> </jaxb:property> </xs:appinfo> </xs:annotation> </xs:element>
<xs:element name="partition" minOccurs="0" maxOccurs="1" type="test_partition_type">
                            <xs:annotation>
                                <xs:appinfo>
                                    <jaxb:property>
                                        <jaxb:baseType>
                                            <jaxb:javaType name="TestPartitionType" parseMethod="TestPartitionTypeAdapter.decode"
                                                printMethod="TestPartitionTypeAdapter.encode" />
                                        </jaxb:baseType>
                                    </jaxb:property>
                                </xs:appinfo>
                            </xs:annotation>
                        </xs:element>
in my xsd... is there a way to generate that javaType with scalaxb? I'm not certain how i'd reference it. thoughts?
Milad Khajavi
@khajavi
@eed3si9n
I've two xsd files in my project located in src/main/xsd directory.
Is there any way, to instruct the scalaxb-sbt to create separate xmlrotocol for each of my xsd files?
eugene yokota
@eed3si9n
@khajavi it's possible, but it's kind of complicated. you'd probably be better off making a mini subproject in sbt for each.
if you're interested (in the complicated approach that I no longer recommend) I documented it in 2012 - https://scalaxb.org/multiple-configs
Chad Selph
@chadselph
@eed3si9n i wonder if you have thoughts about this issue, eed3si9n/scalaxb#551 given it seems coursier is being pushed as the distribution tool of choice going forward